Sunday, June 16, 2013

How to view Linux processes

Today I will discuss about Linux processes.

In linux every process has a uniq process ID (PID).
When Linux boot, some processes run in background.
and /sbin/init this is a process which run when the OS boot before any other process
and then daemons process run. /sbin/init this process ID (PID) is always 1.

If we want to see current running process we can do it with the following command

ps

The above command will show only process from current user.
if you want to see all processes, use following command

ps -A

If you want to see all details of each process, run the followinc command

ps aux

if you want to see process from specific user, like process run by user sadiq

ps -u sadiq

If you want to see real-tim view of running process, you can use top command

top

use q or Esc for exiting top program. you can use htop for more interactive result.
htop is not installed by default. you need to install it. For installing htop, you need to install EPEL repository first.

For Redhat / CentOS 5
32bit:
rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
64bit:
rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

for Redhat / CentOS 6
32bit:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
64bit:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

And then run the following command to install htop

yum install htop

When htop is installed, use htop command to see top process list.

Follow my next post to learn about controlling processes.

No comments:

Post a Comment