Q. How do I see all running process in Linux?
A. Both Linux and UNIX support same command to display information about all running process.
ps command gives a snapshot of the current processes. If you want a repetitive update of this status, use top command.
Task: Use ps command
Type the following ps command to display all running process
# ps aux | less
Where,
- -A: select all processes
- a: select all processes on a terminal, including those of other users
- x: select processes without controlling ttys
Task: see every process on the system
# ps -A
# ps -e
Task: See every process except those running as root
# ps -U root -u root -N
Task: See process run by user vivek
# ps -u vivek
Task: Use top command
The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
# top
Output:
To quite press q for help press h.
Task: display a tree of processes
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.
$ pstreeOutput:
Task: Lookup process
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:
$ pgrep firefox
Following command will list the process called sshd which is owned by root user.
$ pgrep -u root sshd
Say hello to htop
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:
# apt-get install htop
or
# yum install htop
Now type htop to run the command:
# htop

(click to enlarge)
See also:
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 11-29-07


{ 21 comments… read them below or add one }
i hope you dont mind, i have borrowed your image showing PS for my assigment, i have have referenced this site and the date
Dom
No offense, but this is akin to posting instructions on how to walk.
@saurabh – I’m glad you think this is like posting instructions on how to walk. I’m also glad that you are such a naturally gifted user that you knew this without ever having to look up how to do this. Some of us have just started using Linux and guess what it is small little tid bits like this that help.
Thanks a lot for the info. It proved really useful. Sometimes it helps when somebody tells you how to walk…
It’s fantastic to know that a great community is behind it.
Thanks
can someone tell me how to create a script that list all processes that are taking more than 10% of cpu time?
thanks
btw i am a noob lol
Great! Thanks
@saurabh no offense, are you an Indian? If so, that explains and if not, set up your own site and don’t post anything on it loser.
Great stuff.
Lol @ akinhowtowalk. Well said!
Great resource
i want to know how can i run command that show me which script is currently running and by which user
Hi Everybody, I got an cleared information in this site. But I want to know that what are the process currently active in my shell. If any body know, please email me @ allimut@gmail.com
Thanks,
-Allimuthu.
Yo thanks heaps for this info! It’s just what I needed! *favourited*
akinhowtowalk good answer for the loser :D
I’ve been walking the Linux path for a long time and it’s nice to see this type of command posted.
To see what is running and consuming resources you could use (exactly as it is shown):
ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed “/^ 0.0 /d”
which is nice to enter into the .bashrc in your home directory as an alias. Like this (on the last line after every other entry):
alias hog=’ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed “/^ 0.0 /d”‘
so the next time I log in I can just type hog at the command line and see all process running and consuming resources, sorted.
Ken
In the path of Linux, if you want to start running without knowing how to walk, what will happen? Begginers know that they can get to the top, but step by step. Otherwise, they’ll fall. And let’s stop the metaphores xD
Hello
Any one help to find command history with date & time.
Thank you. found it very useful :)
Lol@akinhowtowalk well said :)
Regards,
ILoveTakingHelp :P
Thanks for posting this ! You’ve helped me a lot !
thanks for that. i needed this to set something running and set-up on a linux server. but i needed to kill it first so :)thanks.
hello akinhowtowalk
i find this site really usefull and find the stuff what i was looking for…
and saurabh’s comment was not justified…
but what was ur comment on being an indian… i really didnt understood that…and y..
that explains wat..??
Thanks for the htop info, really useful tool!!!