User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

showprocesses [2013/01/27 21:29] (current)
Line 1: Line 1:
 +===== Show all running processes in Linux =====
 +<​h3>​Task:​ Use ps command</​h3>​
 +<​p>​Type the following ps command to display all running process<​br />
 +<​strong>#​ ps aux | less</​strong></​p>​
 +<​li>​-A:​ select all processes</​li>​
 +<​li>​a:​ select all processes on a terminal, including those of other users</​li>​
 +<​li>​x:​ select processes without controlling ttys</​li>​
 +<​h3>​Task:​ see every process on the system</​h3>​
 +<​p><​code>#​ ps -A<br />
 +# ps -e<br />
 +<​h3>​Task:​ See every process except those running as root</​h3>​
 +<​p><​code>#​ ps -U root -u root -N</​code></​p>​
 +<​h3>​Task:​ See process run by user vivek</​h3>​
 +<​p><​code>#​ ps -u vivek</​code></​p>​
 +<​h3>​Task:​ Use top command</​h3>​
 +<​p>​The top program provides a dynamic real-time view of a running system. Type the top at command prompt:<​br />
 +<​code>#​ top</​code></​p>​
 +<p>To quite press <​strong>​q</​strong>​ for help press <​strong>​h</​strong>​.</​p>​
 +<​h3>​Task:​ display a tree of processes</​h3>​
 +<​p>​pstree ​ shows  running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.<​br />
 +<​code>​$ pstree</​code></​p>​
 +<​h3>​Task:​ Lookup process </h3>
 +<​p>​Use pgrep command. pgrep  looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example display firefox process id:<br />
 +<​code>​$ pgrep firefox</​code></​p>​
 +<​p>​Following command will list the process called sshd which is owned by root user.<br />
 +<​code>​$ pgrep -u root sshd</​code></​p>​
 +<​h3>​Say hello to htop</​h3>​
 +<​p>​htop is interactive process viewer just like top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. To install htop type command:<​br />
 +<​code>#​ apt-get install htop</​code><​br />
 +or<br />
 +<​code>#​ yum install htop</​code><​br />
 +Now type htop to run the command:<​br />
 +<​code>#​ htop</​code><​br />
 +-- Main.FredPettis - 25 Feb 2009
showprocesses.txt ยท Last modified: 2013/01/27 21:29 (external edit)