Sunday, December 30, 2012

How to find the process ID of running process and kill a process in Ubuntu/Linux

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}
    
Example:
  • See all java process
$ ps -aux | grep java (This will list the all the java processes)
   Output:

Finding the process id of a process

     Command:  pidof {Process Name} 

     Example:
     
$ pidof  java
    Output:
     
    

Other important commands regarding processes in Ubuntu/Linux Systems 

  • process except those running as root
   $ 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



2 comments:

  1. Create Flash animation films, GIFs, and cartoons with Adobe Animate. Buy the 2D animation software that has tools for puppet design and tweening.Adobe Animate Free Download For Windows 11

    ReplyDelete