Show All Running Processes in Linux

by Vivek Gite on October 12, 2006 · 76 comments

How do I see all running process in Linux?

You need to use the ps command. It provide information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support ps 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.

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: top command

The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
# top
Output:

Fig.01: top command: Display Linux Tasks

Fig.01: top command: Display Linux Tasks

To quit 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.
$ pstree
Sample outputs:

Fig.02: pstree - Display a tree of processes

Fig.02: pstree - Display a tree of processes

Task: Print a process tree using ps

# ps -ejH
# ps axjf

Task: Get info about threads

Type the following command:
# ps -eLf
# ps axms

Task: Get security info

Type the following command:
# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axZ
# ps -eM

Task: Save Process Snapshot to a file

Type the following command:
# top -b -n1 > /tmp/process.log
Or you can email result to yourself:
# top -b -n1 | mail -s 'Process snapshot' you@example.com

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
Sample outputs:

3356

Following command will list the process called sshd which is owned by a user called root:
$ pgrep -u root sshd

Say hello to htop and atop

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 the htop command at the shell prompt:
# htop
Sample outputs:

Fig.03: htop - Interactive Linux / UNIX process viewer

Fig.03: htop - Interactive Linux / UNIX process viewer (click to enlarge)

atop program

The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network. It also shows which processes are responsible for the indicated load with respect to cpu- and memory load on process level; disk- and network load is only shown per process if a kernel patch has been installed. Type the following command to start atop:
# atop
Sample outputs:

Fig.04: Atop Command in Action

Fig.04: Atop Command in Action

See also:

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 76 comments… read them below or add one }

1 dom November 26, 2007

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

Reply

2 saurabh February 20, 2008

No offense, but this is akin to posting instructions on how to walk.

Reply

3 blablabla May 30, 2010

You are a an elitest jerk. Interesting that for someone who believes he already knows everything, you are entirely ignorant of this fact. It is likely that no one was impressed by your comment except yourself.

Reply

4 Cytrax June 6, 2010

Don’t worry, he wrote his original lame comment back in 08. He’s probably less ignorant now.

Great article!

Reply

5 steve September 10, 2011

The guy is an idot

Reply

6 jay March 7, 2008

@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.

Reply

7 anya March 11, 2008

Thanks a lot for the info. It proved really useful. Sometimes it helps when somebody tells you how to walk…

Reply

8 Maria March 26, 2008

It’s fantastic to know that a great community is behind it.

Thanks

Reply

9 Jamal May 15, 2008

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

Reply

10 ddd July 6, 2008

Great! Thanks

Reply

11 akinhowtowalk August 8, 2008

@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.

Reply

12 I'm a INDIAN September 14, 2010

what the hell do u know about indian? shut the hell up and do some linux home work kiddo..

Reply

13 the london dude October 3, 2010

@akinhowtowalk: i’m so glad you’ve demonstrated so much more maturity than saurabh through your sweeping generalization.

Reply

14 WebDesignKing September 8, 2008

Lol @ akinhowtowalk. Well said!

Great resource

Reply

15 hkhk January 2, 2012

Hahah indians are the most dumb nation and yes smelly tooo :)

Reply

16 sarmad November 6, 2008

i want to know how can i run command that show me which script is currently running and by which user

Reply

17 Allimuthu December 25, 2008

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.

Reply

18 mellow_bunny January 14, 2009

Yo thanks heaps for this info! It’s just what I needed! *favourited*

Reply

19 Greg January 29, 2009

akinhowtowalk good answer for the loser :D

Reply

20 Ken February 8, 2009

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

Reply

21 unokpasabaxaki February 16, 2009

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

Reply

22 vivek February 21, 2009

Hello

Any one help to find command history with date & time.

Reply

23 SleepWalker April 1, 2009

Thank you. found it very useful :)
Lol@akinhowtowalk well said :)
Regards,
ILoveTakingHelp :P

Reply

24 the mad hatter May 18, 2009

Thanks for posting this ! You’ve helped me a lot !

Reply

25 HomeHacker2 May 20, 2009

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.

Reply

26 chinmay May 26, 2009

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..??

Reply

27 Jo June 24, 2009

Thanks for the htop info, really useful tool!!!

Reply

28 radutir July 12, 2009

thx.
it’s nice
thx a lot for this tool

Reply

29 guy August 2, 2009

Hey, can someone please give me instructions on how to walk?

Reply

30 stuck here August 7, 2009

Since I learnt how to use ps I forgot how to walk. Anyone know the neccessary commands?

Reply

31 PaNda August 19, 2009

Cool instruction, i dont know there were commands that named “TOP”

and…… i forget how to walk =( *(googling how to walk)

Reply

32 Ray_D August 25, 2009

saurabh, were you born walking? Didn’t think so.

Reply

33 Cameron September 8, 2009

saurabh takes baby steps as he is always half drunk

Reply

34 Chongopants September 24, 2009

saurabh, stfu..

that is all you may go on with your sad life.

Reply

35 saurabh-is-a-retard October 24, 2009

saurabh:
how do you expect newbies to learn if people don’t post stuff like this?

Reply

36 kek October 27, 2009

netstat -tulnap

This command is usefull when you whant to know what process is responsible for each open port.

Reply

37 wat. November 18, 2009

I’m amazed that more then one and a half year after a person has posted a single message,
Chongopants 09.24.09 at 7:17 pm
saurabh, stfu..
that is all you may go on with your sad life.
something like this is still said

Reply

38 Nicolas Pinçon March 9, 2010

very helpful page!! Thx a lot to whoever wrote it

Reply

39 verizon saga May 4, 2010

thankz very much master ..

its a good post .. and very usefull for me :)

htop :D i was find for more times

Reply

40 abhishek May 19, 2010

akinhowtowalk,

Don’t generalize, not all Indians are like saurabh. Grow up. Boasting exists irrespective of race.

Reply

41 Sumit June 2, 2010

@akinhowtowalk – I am really offended by your remarks on a specific nation. I dont expects mature guys to make such kind of remark. really very disappointing (i can also go dirty in reaction but i dont prefer to). Make sure you comment on individual and not on any group/society/nation.

@Saurabh – If you are an expert then i will appreciate you posting advance topics on linux and punlish the URL on this forum. If you cant do that much for community then you dont have any rights to comments on someones contribution.

Reply

42 Anonymous June 20, 2010

i probably think saurab never came back to this page after he commented on it. You guys were so foolish enough to comment back . lol
I was just looking for something that can give me the green signal so that i can quit all running processes before i shut my computer…. And i ended up here. Looks i i still cant get what i should type to see only those processes that are running currently. Some thing like the task manager in windows . Any help with that ?

Reply

43 agree September 27, 2011

Green Signal !

Please go ahead and reboot

Reply

44 luis June 22, 2010

Thanks =)

Reply

45 noufalcm July 19, 2010

Hi
I wanted to display only PID and Process name in MAC OS. “ps” doesn’t display process name rather command only. Can Anyone help.
Thanx & regards in advance
Noufal

Reply

46 DaveUK September 12, 2010

I am a complete newbie to linux and I *am* learning to walk with it,, so thanks for the article :)

Reply

47 AndyC September 30, 2010

akinhowtowalk probably said that regarding Indians coz he knows that Indians are smarter .. atleast they make our Business run smoothly ..cheers :)

Reply

48 Alex October 7, 2010

Thanks. In an introduction to UNIX class, this helped out and quicker than looking it up in my textbook.

Reply

49 Muthukrishnan November 25, 2010

Very userful.. Thanks a lot…..!!

Reply

50 Pankaj December 24, 2010

Nice….. got geat help…. Thanks…

Reply

51 Wayne March 28, 2011

Great Site.
Well written articles.
And Just to keep it going…
Why walk when you can run with Linux!!

Reply

52 L.PRINCE RAJ April 5, 2011

I am using Fedora 14 in my laptop. I installed an .rpm file , but i don’t know how to run that software. please help me. I am new for Linux.

Reply

53 Wayne April 5, 2011

Well I think the first best question that needs to be asked is what software have you installed?

Reply

54 L.PRINCE RAJ April 5, 2011

I installed an CFD software named as ‘ZNTutor-CFD-2.1.0-0.i386.rpm’. the installation is successful.

Reply

55 Wayne April 5, 2011

As this is a commercial program I wont be installing it to have a look. I would suggest asking the question in a forum more related / dedicated to this product. Also have a look to find where the package was installed and read the manual that was supplied.
If this manual doesn’t even cover the simple processes I would be a little worried about it considering the subject matter involved.

Reply

56 L.PRINCE RAJ April 6, 2011

Ok I will try to get that..

Reply

57 soundarapandian April 6, 2011

Thanks very useful

Reply

58 gabe May 11, 2011

Very useful keep going on!

Reply

59 Efim May 18, 2011

Very laconic and very good article
Thanks

Reply

60 NewToLinux June 7, 2011

Thanks a lot Vivek for taking the time to post the help for these commands in a detailed manner!

Reply

61 jeff June 30, 2011

Thanks for the help, I found the problem right off!

Reply

62 dizzy July 14, 2011

Very useful, thanks!

Reply

63 kebiraj July 15, 2011

hi,

i’m running one process in linux server with the common user that is using by 20 people from different windows machine, i want to know who executed the command at what time in the linux server? is there any file/log location that having all the commands that executed in the server.

Thanks in adv,
Kebiraj

Reply

64 justme19 August 6, 2011

Thanks a lot for this articles. I searched for one solution and found several in one page. God bless u Vivek for making some of us who are new and started to “walk” with Linux, and for those unjustified comments..well just ignored them.

Reply

65 sheril September 20, 2011

Thanks, Well explained.

Reply

66 Momo October 19, 2011

Many thanks for posting those instructions.

Reply

67 Fred October 20, 2011

Great work, very clear instruction. I’ve been using Linux for 2 years and still believe there’s a lot for me to learn or I should say to know. Pages like this makes a huge difference for learners who try and never give up. I really appreciate the time and efforts of the author, keep it up my friend. As for the guy with “walk” comment I’d like to say you don’t have to read what you don’t like, at least give this guy the credit for the time and effort for putting this together for the world and, go ahead and show the world what you’re ca[able of.

Fred

Reply

68 alvarobsp October 21, 2011

@saurobh: Successful troll is successful. lol

Really helpful post, thanks :)

Reply

69 shailendra November 15, 2011

thank u sir

Reply

70 Raghav November 22, 2011

Can any one tell me how can i list all the processes launched from a directory and sort them to find the process which is consuming more memory than others.
We are using AIX.
Please help me.

Reply

71 chapise November 24, 2011

thanks so much dude.., it really helps me, i’m new in linux

Reply

72 harsha December 13, 2011

good work…thanks :)

Reply

73 meow December 16, 2011

Nice, thanks.

Reply

74 ash7 December 18, 2011

good post. quite useful.

Reply

75 encikkelantan January 4, 2012

hello,i wonder,how to know the details of user who run specific processes?

Reply

76 lanh January 8, 2012

Good stuff thx!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">




Previous post:

Next post: