Everything for the Ubuntu Server Administrator

User Tools

Site Tools


Server Administration

Server Applications

At the Command Line


Copyright 2013 Applied Conscious Technologies, LLC

Terms of Agreement


submit to reddit


At the Command Line

Process Control

See also: Process Monitoring

List Running Processes with ps

The ps command reports running processes.

To list all processes use the -A or -e option

ps -A

Long Format

ps -Al

Very Long Format

includes command line switches and arguments.

ps -AlF

See Every Process Running for a User

ps -U andrew -u andrew u

ps man page:

Find Processes by Name with pgrep

Get PIDs for running processes by name.

pgrep apache

Hierarchical Tree of Running Processes


pstree shows a character-graphics representation of running processes - depicting hierarchal relationships.


Sample Output

     │        └─qmgr

Bash Job Control


The Bash shell has excellent job control features to handle multiple processes. This allows you to have more then one program running at a time. For example you can have a reference like a man page for tar open in one process and vi, the text editor, open in another. Then you can switch back and forth between the two, using information from the reference while you are editing.

The process on your screen is a foreground process.

Processes that are hidden are background processes.

Start a Process into the Background

To start a process in the background, add the & (ampersand) character after its command. Using our example, this will open the man page for tar in the background and vi in the foreground.

man tar&
vi ~/myfile.txt

Briefly, before vi runs, you will see:

[1]-  Stopped                 man tar

This means that man tar is running in the background as job number 1.

Now you can see vi running. Meanwhile the man page for tar is running the background.

Put the Current Process into the Background

Pressing control-z will put the current foreground process into the background. Again, using our example, this will put vi into the background. You will see:

[2]+  Stopped                 vi ~/myfile.txt

Jobs Command

The jobs command will show a list of currently running jobs, with their job numbers.


…will show:

[1]+  Stopped                 man tar
[2]-  Stopped                 vi ~/myfile.txt

Fg Command

The fg command, followed by a job number will put that job into the foreground. In our case, entering:

fg 1

…will show the man page for tar.

Handy Process Control Table

command description
& Put an & character at the end of a command to start it in the background.
control-z Press control-z to put the current foreground process into the background.
jobs The jobs command shows the job numbers of current job processes.
fg Entering the fg command followed by a job number will put that job into the foreground.

process_control.txt · Last modified: 2015/05/31 21:20 (external edit)