Using PS Commands
PS Commands gives out information of currently running process with process IDs(PID).Easy way to find a PID of a process is to use PS commands.I have described full article about how to find process details along with process ids and how to kill a user specified process.Listing all running processes in the system
Linux systems offer commands to list each and every process runs in the system
Command: ps -aux | less
Output:
Finding a process by specifying a name
User is capable of finding the process id and the details of a process by specifying the process name along with the commands.This is one of advantage of pipe and filter architecture in the Ubuntu.In the output image the process details can be describe as follows.First line "harsha" is the owner of the process and the next "5914" is the process id of the process.For more details
Command : ps -aux | grep {process name}
Command : ps -aux | grep {process name}
Example:
- See all java process
$ ps -aux | grep java (This will list the all the java processes)
Finding the process id of a process
$ ps -U root -u root -N
- See process run by user harsha
$ ps -u harsha
Kill a user specified process
At some movements user need to kill a process after identified required process id by using above methods.
Command: kill {process id} or kill -9 {process id}
Example:
- Kill a process
$ kill 3486
- Kill a process forcefully(Sometimes force kill required for kill a processes which are not kill by normal kill command. "-9" is specify a forceful kill.
$ kill -9 3486
References