Wednesday, September 26, 2012

Ninth session of Some of basic UNIX commands that are useful very frequently


Today we are going to discuss about one more important command in UNIX/LINUX based operating system that is used to kill processes that are running currently. It is some what like Task Manager in our windows based systems where task manager can be used to view/kill processes that are running currently instead this command is used only to kill processes.

kill -9 1234

Above command will kills process with process ID(PID) '1234'. You can get to know currently running process's PIDs by using 'ps' command that we discussed in our previous post. Below is sample output that a 'ps' command will show:



In above output, IDs that are present under heading 'PID' like '2660, 5796 and 4484'are PIDs similar to '1234' in out above kill example.

In our above example command '-9' that we used to kill process is signal that we are sending to kill process. There are several signals that we can send to kill process are below:




kill 4242

Above command will kill PID 4242 and exit gracefully.

kill -s SIGKILL 1414
kill -s KILL 1414
kill -s 9 1414
kill -SIGKILL 1414
kill -KILL 1414


All above commands are similar equal to above explained first example's -9 SIGKIL (i.e. forcefully kill 1414 process).

Please feel free to post your valuable comments. We will discuss about some more commands in our next posts.


No comments: