Archives

Entries tagged 'unix'

Disabling or termination plans UNIX or Linux systems

In this tutorial we will learn how you can disable or terminate programs UNIX or Linux systems.

Linux and all other UNIX systems come commands neutralization. Send commands neutralization specific signal (such as neutralization process) a specific process or process group.

If the signal is not listed, the TERAM signal is sent.

Neutralization processes with the use Kill command in Linux / UNIX

Ordinance neutralization works under the Linux, BSD and UNIX-like operating systems.

Step One: Finding the PID of the process (process ID)

Use ps or pidof command to find the process ID (PID). Syntax:

ps aux | grep processname
pidof processname

processname = שם התהליך.

ps aux | grep httpd

הפלט אמור להיראות בערך ככה:

root      8886  0.0  0.7  32276 15660 ?        Ss   00:11   0:00 /usr/sbin/httpd -k start -DSSL
apache   17312  1.4  0.8  35436 18240 ?        S    00:43   0:03 /usr/sbin/httpd -k start -DSSL
apache   17751  1.1  0.8  35548 18536 ?        S    00:45   0:01 /usr/sbin/httpd -k start -DSSL
apache   17755  1.2  0.8  35200 17908 ?        S    00:45   0:01 /usr/sbin/httpd -k start -DSSL
apache   17831  1.0  0.8  34556 17544 ?        S    00:46   0:00 /usr/sbin/httpd -k start -DSSL
apache   17927  1.2  0.7  33804 16492 ?        S    00:46   0:00 /usr/sbin/httpd -k start -DSSL
apache   17929  2.0  0.7  33620 16408 ?        S    00:46   0:00 /usr/sbin/httpd -k start -DSSL
apache   17935  2.1  0.8  34588 17324 ?        S    00:46   0:00 /usr/sbin/httpd -k start -DSSL
apache   17990  2.3  0.8  34516 17256 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18000  1.3  0.8  33928 16608 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18055  2.1  0.7  33580 16224 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18056  0.0  0.6  32276 14152 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18057  8.6  0.7  33572 16336 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18061  2.7  0.8  33932 16560 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18062  0.0  0.7  32784 14660 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18063  0.0  0.6  32276 14184 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18064  1.7  0.7  33480 16112 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18079  0.0  0.7  32784 14528 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18082  0.0  0.6  32276 14136 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
apache   18083  0.0  0.7  33572 16204 ?        S    00:47   0:00 /usr/sbin/httpd -k start -DSSL
root     18086  0.0  0.0   3940   720 pts/1    R+   00:47   0:00 grep httpd

או השתמשו בפקודת pidof שאמורה למצוא את מזהה התהליך(ID) של תוכנית רצה:

pidof httpd

הפלט צריך להיראות ככה:

18414 18408 18257 18256 18205 18100 18083 18079 18063 17935 17312 8886

שלב שני: נטרול התהליך ע"י שימוש בPID-(מזהה התהליך)

הפקודה הזו מציגה את ה-PID של התהליך ( httpd (8886. עכשיו ננטרל את התהליך על ידי שימוש ב-PID הזה:

kill 8886

אך ניתן גם דרך:

kill -9 8886

איפה ש,

-9 סימון מיוחד לנטרול תהליך, אשר ינטרל אותו.

דוגמאות לפקודות killall

אל תשתמשו בפקודות killall במערכת UNIX (פקודה לLinux בלבד).
אתם יכולים להשתמש בפקודות killall . פקודת killall מנטרלת תהליכים לפי השם(לא נדרש מזהה התהליך – PID):

killall -9 httpd

נטרול התהליך mysqld:

killall -9 mysqld

בהצלחה!