Jump to content

Guide to Unix/Commands/Process Management

From Wikibooks, open books for an open world

nohup

[edit | edit source]

nohup lets you run a program in a way which makes it ignore hangup signals. This can be used to make a program continue running after a user has logged out. The output of the program is redirected from the standard output to the file nohup.out.

Examples:

$ nohup wget http://foo.org/foo_list.gz
nohup: appending output to `nohup.out'
$

Links:

ps displays a list of current processes and their properties.

Examples:

Processes owned by the current user:

$ ps
  PID TTY          TIME CMD
17525 pts/0    00:00:00 su
17528 pts/0    00:00:00 bash
17590 pts/0    00:00:00 ps where pid is process id.

All processes:

$ ps -A

Links:

kill is used to send termination signals to processes.

Examples

To send the kill signal to the processes with process id 17525,

$ kill -9 17525

To send the kill signal to all processes,

$ kill -9 -1

see Guide to Unix/Commands/Process Management/Kill

Links:

pgrep

[edit | edit source]

pgrep search and kill system processes

Example: Check if apache webserver is running.

$ pgrep -f apache
 5580
 5581
 5582
 5583
 5584
 5585
or
$ svcs -a | grep -i apache.

Links:

pkill

[edit | edit source]

Stop xterm program with 'pkill' program:

$ pkill -9 xterm

Tips: Display all the process of a user

$ pgrep -l -u arky
894 bash
895 bash
897 bash
898 bash
899 bash
1045 links
1396 startx
1407 xinit
1411 openbox
1412 xterm
1413 xfaces
1414 xsetroot
1415 emacs

Links:

pidof

[edit | edit source]

pidof display Process ID (PID) of a task

Example: Display the PID of emacs process:

$ pidof emacs
1415

Links:

  • pidof, manpages.ubuntu.com

killall

[edit | edit source]

killall kill a process by name

Example:

Kill the 'xfaces' program:

$ killall xfaces

Links: