The ps command in Linux is used to view information about running processes. It displays details such as the process ID (PID), user, CPU usage, memory usage, and the command executed. This command is essential for system monitoring and management.
Example Commands:
ps
This command shows a basic list of running processes, including PID, USER, CPU%, MEMORY%, TIME, and COMMAND.
ps -a
Displays all processes for the current terminal, including those not shown in other views.
ps -f
Provides a full-format view of processes, showing additional details like UID, PID, PPID, and STAT.
ps aux --sort %cpu
Lists all processes sorted by CPU usage in descending order to identify high-CPU tasks.
ps aux --sort %mem
Displays processes sorted by memory usage, helping to find memory-intensive applications.
ps aux | grep firefox
Filters processes to show only those related to “firefox,” useful for locating specific tasks.
kill -9 1234
Kills the process with PID 1234 using a forceful termination signal, stopping it immediately.
The ps command is an essential tool in Linux for managing and monitoring system processes. With various options, it provides detailed insights into running tasks, helping users optimize performance and troubleshoot issues efficiently.