Command line tips - listing with ps

Listing processes is quite a common task you might have to perform if you're messing around with your command line interface.

There are actually two great command line tools for listing processes, but in this tip post, I'm going to focus on ps.

If you run the command just on its own, you won't get all that many processes show up:

$ ps
  PID TTY          TIME CMD

3475 pts/1 00:00:00 bash
4083 pts/1 00:00:00 ps

In fact, that only shows you processes that are yours and that are running on the same terminal session, which in this case, is my shell (bash) and the ps command. Sometimes, though, that isn't very useful. To view all processes running on the machine, regardless of which terminal they're running under and who owns them, run:

$ ps aux

This will give you a very long list of processes - literally everything running. Armed with this information, you can now use other command line tools like grep to search through the list and find what you are looking for, for example.

In fact, I've actually looked at ps before, in the context of using it to kill a process which is misbehaving.

There are also a lot of other advanced options that you can use with ps, so many that I won't go into detail here. Head over to the manual page for more information (beware though, it's pretty geeky):

$ man ps

If you're interested in ps's counterpart top, then I have a post I did back in December which explains a little bit about it.

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Command line tips - listing with ps

Home » Articles » Command line tips - listing with ps