Master Linux Process Management: ps, top, htop, and kill Commands Explained
This guide walks through essential Linux process‑monitoring tools—ps, top, and htop—detailing their options and output fields, and explains process control techniques using kill, killall, and job‑control commands, helping readers efficiently view, sort, and manage system processes.
1. Process Viewing and Management Tools
ps command : reports a snapshot of current processes.
Common options:
-A or -e: show all processes
-a: all processes not associated with a terminal
-u: processes owned by a specific user
-x: include processes without a controlling terminal (often used with -a or -u)
-f: full‑format listing
Typical combinations: ps -ef – full information for all processes ps -efH – display process hierarchy ps -aux – all processes with detailed info ps -axo pid,command,psr,pri,ni – custom columns (PID, command, processor, priority, nice)
Command demonstration :
2. top Command
top dynamically displays Linux task information.
Key fields in the header line:
UID/PID/PPID – user, process ID, parent process ID
C – CPU usage percentage
STIME – process start time
TTY – controlling terminal
TIME – cumulative CPU time
CMD – command name
Common column headings:
USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND
STAT values:
R – running
S – interruptible sleep
D – uninterruptible sleep
T – stopped
Z – zombie
Interactive options (press the corresponding key while top is running):
P – sort by CPU usage
M – sort by memory usage
T – sort by running time
l – toggle load average line
t – toggle task summary
1 – show per‑CPU statistics
m – toggle memory information
q – quit
s – change refresh delay
k – kill a process
3. htop Command
htop is an interactive process viewer.
Basic usage: htop – launch the viewer
Key shortcuts:
u – filter by user
l – show files opened by the highlighted process
s – display system calls of the highlighted process
a – bind a process to a specific CPU
# – jump to the process with the given PID
Supported options:
-d – set delay
-u USERNAME – show only processes of USERNAME
-s COLUMN – sort by the specified column
4. Linux Process and Job Management
Process management involves sending signals to control processes, typically using the kill command.
Useful commands: kill -l – list all available signals kill -s SIGNAL PID – send a specific signal killall PROCESS_NAME – terminate all processes with the given name
Common signals:
SIGHUP (1) – reload configuration
SIGINT (2) – interrupt (Ctrl+C)
SIGKILL (9) – force kill
SIGTERM (15) – graceful termination
SIGSTOP (19) – stop process
Job control allows moving jobs between foreground and background.
Typical commands:
Ctrl+Z – suspend the current job command & – run a command in the background
fg %JOBNUM – bring a background job to the foreground
bg %JOBNUM – resume a stopped job in the background
kill %JOBNUM – terminate a specific job
Author: 小耳朵 – Source: purify.blog.51cto.com
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
