Mastering Linux Process Management đ§đ
A #Twitter Thread with 20 most useful commands with examples đ
A #Twitter Thread with 20 most useful commands with examples đ
What is Linux Process Management ?
Linux process management refers to the ability to control and monitor processes running on a Linux system.
Linux process management refers to the ability to control and monitor processes running on a Linux system.
đ 1/20: ps - List running processes.
Example: ps aux
- Show all processes running on the system.
Example: ps aux
- Show all processes running on the system.
đ 2/20: top - Monitor real-time system resource usage.
Example: top
- Display dynamic CPU, memory, and process information.
Example: top
- Display dynamic CPU, memory, and process information.
đ 3/20: htop - Interactive process viewer with more features than top.
Example: htop
- Visualize system activity and manage processes interactively.
Example: htop
- Visualize system activity and manage processes interactively.
đĒ 4/20: kill - Terminate a process by its PID.
Example: kill 1234
- Stop process with PID 1234.
Example: kill 1234
- Stop process with PID 1234.
đĢ 5/20: killall - Terminate processes by name.
Example: killall firefox
- End all processes named "firefox".
Example: killall firefox
- End all processes named "firefox".
đĨ 6/20: pkill - Terminate processes based on pattern matching.
Example: pkill -f "python"
- Stop all processes containing "python" in their command line.
Example: pkill -f "python"
- Stop all processes containing "python" in their command line.
đ 7/20: pgrep - List PIDs based on process name.
Example: pgrep sshd
- Retrieve PIDs of processes named "sshd".
Example: pgrep sshd
- Retrieve PIDs of processes named "sshd".
đ 8/20: renice - Change priority of running processes.
Example: renice +10 1234
- Increase priority of process with PID 1234.
Example: renice +10 1234
- Increase priority of process with PID 1234.
đŠ 9/20: nice - Launch a command with a specific priority.
Example: nice -n 10 command
- Run "command" with a lower priority.
Example: nice -n 10 command
- Run "command" with a lower priority.
đĢ 10/20: nohup - Run a command that keeps running even after logging out.
Example: nohup ./script.sh &
- Run "script.sh" in the background with no hangup.
Example: nohup ./script.sh &
- Run "script.sh" in the background with no hangup.
âŠī¸ 11/20: bg - Move a process to the background.
Example: bg %1
- Move the first suspended job to the background.
Example: bg %1
- Move the first suspended job to the background.
đ 12/20: fg - Bring a background process to the foreground.
Example: fg %1
- Bring the first background job to the foreground.
Example: fg %1
- Bring the first background job to the foreground.
đ 13/20: jobs - List active jobs running in the background.
Example: jobs
- Display all active background jobs.
Example: jobs
- Display all active background jobs.
đ 14/20: psgrep - Filter process list using grep.
Example: ps aux | grep sshd
- List processes containing "sshd" using ps and grep.
Example: ps aux | grep sshd
- List processes containing "sshd" using ps and grep.
â 15/20: watch - Execute a command repeatedly and monitor its output.
Example: watch -n 1 'ps aux | grep python'
- Watch processes with "python" in their name every 1 second.
Example: watch -n 1 'ps aux | grep python'
- Watch processes with "python" in their name every 1 second.
đŦ 16/20: strace - Trace system calls and signals of a running process.
Example: strace -p 1234
- Trace system calls of process with PID 1234.
Example: strace -p 1234
- Trace system calls of process with PID 1234.
đ 17/20: lsof - List open files associated with a process.
Example: lsof -p 1234
- List files opened by process with PID 1234.
Example: lsof -p 1234
- List files opened by process with PID 1234.
âąī¸ 18/20: uptime - Show system uptime and load averages.
Example: uptime
- Display the current system uptime and load averages.
Example: uptime
- Display the current system uptime and load averages.
đŗ 19/20: pstree - Display a tree of running processes.
Example: pstree
- Visualize running processes in a hierarchical tree.
Example: pstree
- Visualize running processes in a hierarchical tree.
â 20/20: killall5 - Send a signal to all processes (init).
Example: killall5 -15
- Send a SIGTERM signal to all processes (init).
Example: killall5 -15
- Send a SIGTERM signal to all processes (init).
đĨ 1/5: systemctl - Control systemd services.
Example: systemctl start apache2
- Start the Apache web server.
Example: systemctl start apache2
- Start the Apache web server.
â° 2/5: at - Schedule a command to run at a specific time.
Example: at 2:00 PM tomorrow
- Schedule a command to run tomorrow at 2:00 PM.
Example: at 2:00 PM tomorrow
- Schedule a command to run tomorrow at 2:00 PM.
đĄī¸ 3/5: nice - Change the priority of a running process.
Example: nice -n 10 command
- Run "command" with a lower priority.
Example: nice -n 10 command
- Run "command" with a lower priority.
đž 4/5: ionice - Set the I/O priority of a process.
Example: ionice -c 2 -n 0 command
- Run "command" with the highest I/O priority.
Example: ionice -c 2 -n 0 command
- Run "command" with the highest I/O priority.
â 5/5: schedstat - Display scheduler statistics for a process.
Example: schedstat -p 1234
- Show scheduler statistics for process with PID 1234.
Example: schedstat -p 1234
- Show scheduler statistics for process with PID 1234.
That concludes the list of useful Linux process management commands! Feel free to explore these commands for effective process control. đģđ§
Loading suggestions...