Rakesh Jain
Rakesh Jain

@devops_tech

30 Tweets 1 reads Oct 08, 2023
Mastering Linux Process Management 🐧📋
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.
📋 1/20: ps - List running processes.
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.
🌟 3/20: htop - Interactive process viewer with more features than top.
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.
đŸ”Ģ 5/20: killall - Terminate processes by name.
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.
🔍 7/20: pgrep - List PIDs based on process name.
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.
🎩 9/20: nice - Launch a command with a specific 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.
â†Šī¸ 11/20: bg - Move a process 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.
🔃 13/20: jobs - List active jobs running in the background.
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.
⌚ 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.
đŸ”Ŧ 16/20: strace - Trace system calls and signals of a running process.
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.
âąī¸ 18/20: uptime - Show 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.
❗ 20/20: killall5 - Send a signal to all processes (init).
Example: killall5 -15
- Send a SIGTERM signal to all processes (init).
Time for some Bonus 😍
đŸ”Ĩ 1/5: systemctl - Control systemd services.
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.
đŸŒĄī¸ 3/5: nice - Change the priority of a running process.
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.
⌛ 5/5: schedstat - Display scheduler statistics for a process.
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. đŸ’ģ🐧
Retweet the thread if you find it useful. Thanks!
#Linux #ProcessManagement

Loading suggestions...