Overview
ps -ef lists all processes running on the system with detailed information including User ID, Process ID, Parent Process ID, CPU usage, start time, terminal, CPU time, and the command being executed. This is useful for understanding the current system state and identifying specific processes.
ps -ef Output Column Descriptions
The main output columns of the ps -ef command are as follows:
- UID: User ID of the process owner
- PID: Process ID
- PPID: Parent Process ID
- C: CPU utilization (CPU usage over a recent period)
- STIME: Process start time
- TTY: Terminal associated with the process (tty, pts, etc.)
- TIME: Total CPU time consumed by the process
- CMD: Command and its arguments
Key Options
The ps command allows controlling the output format through various options. The 'ps -ef' combination is a union of the '-e' and '-f' options.
Process Selection and Output Format
Generated command:
Try combining the commands.
Description:
`ps` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Various usage examples of the ps -ef command.
Display detailed information for all processes
ps -ef
Outputs detailed information for all processes running on the system.
Search for specific processes
ps -ef | grep sshd
Combines with the grep command to search for processes containing a specific keyword (e.g., sshd process).
Search for processes of a specific user
ps -ef | grep root
Searches only for processes executed by a specific user (e.g., 'root').
View top N processes with headers
ps -ef | head -n 5
When the output is extensive, displays the top few lines including headers. (e.g., top 5 lines)
Check information for a specific PID
ps -ef | grep 1234
Checks detailed information for a process with a specific PID (e.g., 1234).
Tips & Notes
ps -ef is a powerful tool for understanding system status, but its output can be extensive, so it's common to use it in conjunction with other commands like grep.
ps aux vs ps -ef
The ps command supports two main option styles: System V style (e.g., -ef) and BSD style (e.g., aux). Both display all processes, but the output format and some information may differ. -ef is the 'full' format in System V style, while aux is the 'all users' and 'full' format in BSD style.
- ps -ef: System V style, all processes, detailed information (UID, PID, PPID, C, STIME, TTY, TIME, CMD)
- ps aux: BSD style, all user processes, detailed information (USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND)
Filtering with grep
The output of ps -ef can be very long, so it's always recommended to use it with grep to quickly find the information you need. For example, 'ps -ef | grep httpd' will only show httpd-related processes.
Terminating Processes
You can use the PID identified with ps -ef to terminate a specific process using the kill command. For example: 'kill