The Complete Guide to Command Line Process Viewer/Killer/Suspender Tools
System administrators, developers, and power users frequently need to monitor and manage running applications. When a graphical user interface (GUI) freezes or is unavailable, the command line interface (CLI) provides absolute control over system resources.
This guide covers the essential tools across Linux, macOS, and Windows to view, terminate, and pause processes entirely from the terminal. Part 1: Process Viewers (Monitoring and Inspection)
Before you can manage a process, you must find it. Process viewers display system resource consumption (CPU, memory) and reveal unique Process IDs (PIDs). 1. ps (Process Status) – Linux & macOS
The ps utility provides a snapshot of current processes. It is highly customizable using specific flags.
Standard detailed view: ps aux (Displays processes for all users with CPU/Memory usage). View by user: ps -u username Search for a specific process: ps aux | grep nginx 2. top (Table of Processes) – Linux & macOS
Unlike ps, top provides a real-time, dynamic view of a running system. It updates every few seconds and ranks processes by resource consumption. Launch: top Key interactive commands (while running): M – Sort by memory usage. P – Sort by CPU usage. q – Exit the utility. 3. htop (Interactive Process Viewer) – Linux & macOS
htop is an advanced, text-based interactive process viewer. It improves upon top by offering a color-coded display, mouse support, and a clearer visualization of multi-core CPU usage. Launch: htop Key features: Use arrow keys to scroll vertically and horizontally. Press F3 to search for a process name. Press F6 to change sorting criteria easily. 4. tasklist – Windows (CMD & PowerShell)
Windows provides a native command-line tool to view running applications. List all processes: tasklist
Filter by application name: tasklist /FI “IMAGENAME eq chrome.exe” Find DLLs associated with processes: tasklist /M Part 2: Process Killers (Termination)
When an application stops responding or consumes excessive resources, process killers forcefully close it. 1. kill – Linux & macOS
The kill command sends a specific signal to a process using its PID.
Graceful termination (SIGTERM): kill PID (Requests the app to save data and close safely).
Forceful termination (SIGKILL): kill -9 PID (Instantly halts the process; may cause data loss). 2. pkill and killall – Linux & macOS
Typing PIDs can be slow. These commands allow you to terminate processes using their names instead of numbers. Kill by exact name (Linux): killall firefox Kill by pattern/partial name (Linux/macOS): pkill -f chrome 3. taskkill – Windows (CMD & PowerShell)
Windows utilizes taskkill to stop processes from the command line. Graceful close by name: taskkill /IM notepad.exe Forceful close by name: taskkill /F /IM notepad.exe Forceful close by PID: taskkill /F /PID 1234 Part 3: Process Suspenders (Pausing and Resuming)
Sometimes you do not want to destroy a process; you simply want to pause it to free up CPU cycles for another urgent task, then resume it later. 1. kill -STOP and kill -CONT – Linux & macOS
You can use the standard kill command infrastructure to freeze and thaw processes via signals.
Suspend/Freeze a process: kill -STOP PID (or pkill -STOP process_name)
Resume/Thaw a process: kill -CONT PID (or pkill -CONT process_name) 2. Terminal Job Control – Linux & macOS
If you are running a command directly inside your active terminal window, you can use built-in shell shortcut keys.
Suspend current foreground task: Press Ctrl + Z (This pauses the task and gives you back the command prompt). View suspended tasks: Type jobs
Resume task in background: Type bg %1 (where 1 is the job number). Resume task in foreground: Type fg %1 3. PowerShell Process Suspending – Windows
Windows does not have a simple native taskpause CLI tool, but modern Windows systems can utilize PowerShell to access underlying system features.
Suspend a process: Suspend-Process -Name “target_app” (Requires specific community modules, or utilizing native .NET calls like [System.Diagnostics.Process]::GetProcessById(PID) combined with internal API suspends).
Alternative: Power users frequently use the Sysinternals command-line tool pssuspend. Suspend: pssuspend notepad.exe Resume: pssuspend -r notepad.exe Summary Cheat Sheet Operating System View Processes Kill (Graceful) Kill (Forceful) Suspend Process Resume Process Linux / macOS ps aux, top, htop kill PID kill -9 PID kill -STOP PID kill -CONT PID Windows tasklist taskkill /IM name taskkill /F /IM name pssuspend name pssuspend -r name
Mastering these command-line tools allows you to maintain total control over system performance, recover hung systems rapidly, and manage background tasks without ever touching a mouse.
Leave a Reply