tools:bash:processes
Table of Contents
This article is Part 3 in a series of cheat-sheets on the command line shell, bash. (Previous Page | Next Page)
bash: Managing Processes
Show Processes
$ ps
Show running processes for user. Some options include:
-e
(See every process)-f
(Full format)-F
(Extra full output)-u
(Another long format)-H
(Hierarchical format)–forest
(Output ASCII tree)
Show user's processes running in background mode:
$ jobs -l
Use the command htop
for real-time process info. (Which is similar to the Task Manager if you're coming from Windows.) btop
is a another useful process manager.
Moving, Starting and Stopping Processes
Move background process x to foreground:
$ fg x
Start running process x in background:
$ bg x
kill
$ kill pid
Sends TERM signal to specified PID (Process ID). Some options include:
-s signal
(Specify alternate signal to send)-l
(Show list of available signals)$ killall name
* (Kill all processes starting with a name of name)
Process Signals
- 1 - HUP (Hangs up)
- 2 - INT (Interrupts)
- 3 - QUIT (Stops running)
- 9 - KILL (Unconditionally terminates)
- 11 - SEGV (Produces segment violation)
- 15 - TERM (Terminates if possible)
- 17 or 19 - STOP (Stops unconditionally, but doesn't terminate)
- 18 or 20 - TSTP (Stops or pauses, but continues to run in background)
- 19 or 18 - CONT (Resumes execution after STOP or TSTP)
Process States
- O (Running on processor)
- S (Sleeping)
- R (Running)
- Z (Zombie, process terminated but parent not available)
- T (Traced or stopped)
- D (Interruptible sleep)
PS Columns
- UID (User responsible for launching process)
- PPID (Process ID of the parent process)
- PID (Process ID of the process)
- PRI (Priority of the process, with higher numbers = lower priority)
- NI (Nice value, used for determining priorities)
- S (State/Status of the process)
- C (Processor utilization over lifetime of the process)
- STIME (System time when process was started)
- TTY (Terminal device from which the process was launched)
- TIME (Cumulative CPU time required to run the process)
- CMD (The name of the program that was started)
- F (System flags assigned to the process)
- ADDR (Memory address of the process)
- SZ (Approximate amount of swap space required if process were swapped out)
- WCHAN (Address of the kernel function where process is sleeping)
Top Columns
- USER (User responsible for launching process)
- PID (Process ID of the process)
- PRI (Priority of the process, higher numbers = lower priority)
- NI (Nice value, used for determining priorities)
- S (State/Status of the process)
- VIRT (Amount of virtual memory used by the process)
- RES (Amount of physical memory used by the process)
- SHR (Amount of memory the process is sharing with other processes)
- %CPU (Share of CPU time that the process is using)
- %MEM (Share of available physical memory the process is using)
- TIME+ (Total CPU time the process has used since starting)
- COMMAND (The command line name of the process)
- Previous Page: ← Keyboard Shortcuts & Piping Commands
- Next Page: Users & Permissions →
This article is part of a series on Command Line | |
Linux, MacOS & BSD | |
---|---|
Shells: | Bash (Getting Started - Shortcuts & Piping - Managing Processes - Users & Permissions - Files & Archives - Customization) - zsh |
Emulators/Multiplexers: | tmux |
Windows | |
PowerShell |
tools/bash/processes.txt · Last modified: 2025/01/04 03:36 by Humphrey Boa-Gart
Find this page online at: https://bestpoint.institute/tools/bash/processes
Find this page online at: https://bestpoint.institute/tools/bash/processes