Process Control
GNU coreutils
Command | Comment |
---|---|
kill |
Send a signal to processes |
sleep |
Delay for a specified time |
timeout |
Run a command with a time limit |
nohup |
Run a command immune to hangups |
Process Information
List Processes
ps aux
or
apt install procps # Debian, Ubuntu
dnf install procps-ng # RedHat
pgrep <pattern>
PID
pidof <process-name>
top
/ htop
- View Processes Dynamically
top
or
apt install htop
dnf install htop
htop
pstree
- Display Process Tree
apt install psmisc
dnf install psmisc
pstree <pid>
Process File System
/proc/<pid>
Signal
kill -l
kill [-<signal=SIGTERM>] <pid>
killall [-u <user>] [-<signal=SIGTERM>] <proc-name>
apt install procps
dnf install procps-ng
pkill [-u <user>] [-<signal>] <process-name>
Jobs
Putting a Process in the Background
$ <cmd> &
[job-id] <pid>
jobs
- List jobs
$ jobs
[job-id]+ Running <cmd> &
Returning a Process to the Foreground
$ fg %<job-id>
<cmd>
Resume the program’s execution in the background
Stopping (Pausing) a Process by Ctrl+Z
.
$ jobs
[job-id]+ Stopped <cmd>
then
$ bg %<job-id>
[job-id]+ <cmd> &