Processes and Jobs Guide

+6 Bucky Roberts · January 13, 2016
Process - running program

# list processes

  • PID - process ID

  • TTY - terminal where process is running

  • STAT - state (sleeping or running)

  • TIME - amount of CPU time processor spent running instructions

  • COMMAND - name

# all your running processes
ps x

# all system processes, not just ones you own
ps ax

# include detailed info
ps u

# show full command names
ps w

Controlling Jobs

  • Usually when you run a command, you don’t get the prompt back until the command is finished.

  • You can however tell a process to run in the background (useful if it takes a long time)

# Just a dumb sample program we can play with

  • Shell does not return because the program is still running

  • Ctrl+C to send interrupt signal (ask it nicely to stop)

# To run to process in the background so we can keep using our shell
xlogo &

  • Returns job number and process ID

  • Process that we launch in this way can be referred to as jobs (assigned a special job number)

# To list the jobs that we launched from the terminal

What if we want to stop it? Since it’s in the background we can’t control it with the keyboard

# Bring a job to the foreground (percent sign then job number)
fg %1

# Stop (aka pause/freeze) a process

We get shell back, but can’t close the window because it is paused

# To unpause
fg %1

Note: Since a job is just a type of process, you can also use the process ID

# To kill (terminate) a process, send it a kill signal
xlogo &
kill pid

# just freeze, don’t kill completely
xlogo &
kill -STOP pid

# to resume a stopped process
kill -CONT pid
kill pid


  • Ctrl + C is the same as using kill

  • When you kill a process, you are actually sending it a signal

  • That way, the process can do things (like save files it needs to) before it closes

  • You can only kill processes you own

  • To kill processes you don’t own, you need to have superuser privileges

Post a Reply


Oldest  Newest  Rating
0 Arch38 ツ · June 17, 2016
Pretty good guide, thanks Bucky :)
0 jiggunjer jiggunjer · August 29, 2016
Good follow-up subjects: 
- standard out/err/in and control signals (SIGINT, SIGSTOP, SIGHUP, etc.)
- how to close the terminal without killing jobs (e.g. nohup, disown)
- Bash subshells (e.g. `(foo&)` ) 
- Terminal multiplexing (e.g. tmux or screen) -- basically the 'minimize' equivalent for terminals
  • 1



Linux is a free and open source software operating system for computers.

Bucky Roberts Administrator