User Tools

Site Tools


showprocesses

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> <p>Where,</p> <ul> <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> </ul> <h3>Task: see every process on the system</h3> <p>

# ps -A<br />
# ps -e<br />

</p> <h3>Task: See every process except those running as root</h3> <p>

# ps -U root -u root -N

</p> <h3>Task: See process run by user vivek</h3>

<p>

# ps -u vivek

</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 />

# top

</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 />

$ pstree

</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 />

$ pgrep firefox

</p> <p>Following command will list the process called sshd which is owned by root user.<br />

$ pgrep -u root sshd

</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 />

# apt-get install htop

<br /> or<br />

# yum install htop

<br /> Now type htop to run the command:<br />

# htop

<br />

– Main.FredPettis - 25 Feb 2009

showprocesses.txt · Last modified: 2013/01/28 04:29 by 127.0.0.1