Tuesday, February 16, 2016

Usage of 'ps' and 'kill' command in linux

Hi,

Here I have tip on processes.

suppose if I want to see list of currently running processes then we have a system command as 'ps'.

With this we can see list of processes as below if we use additional arguments.

command: $ps -ef




In the same way we have a scenario like, I want to see is there any java process running in my machine.

For this we have to filter above list of processes using additional pipe with grep,

command: $ps -ef | grep java



In this way we can easily find out whether any background service or any process running in the background.


Additional:
---------------

If we want to kill the above process then use 'kill' command with additional argument of 9.

command: $kill -9 7302

The above will invoke the system call kill on that process and the process will be killed in milliseconds.


No comments:

Post a Comment