In Linux, the “ps” command is a command-line utility for viewing information about the running processes. The “ef” option stands for “full” and is used to display the command line arguments passed to the process, in addition to the other information normally shown by the “ps” command.
The objective of this guide is to explain the “ps -ef” command in Linux with the help of suitable examples.
Let’s start with the “ps-ef” command.
How Does the “ps-ef” Command Work in Linux?
The “ps -ef” command displays a list of processes, with each process occupying one line. Let’s see the basic working of the “ps -ef” command by executing the script:
$ ps -ef
The output shows a list of processes. The columns in the output show the following information:
- UID: the user ID of the user who owns the process
- PID: the process ID of the process
- PPID: the process ID of the parent process
- C: the CPU utilization of the process, as a percentage
- STIME: the time at which the process was started
- TTY: the terminal associated with the process
- TIME: the CPU time used by the process
- CMD: the command that was used to start the process, including any command-line arguments passed to the process
Here are some examples of using the “ps ef” command in Linux:
Example 1: Display All Processes Running on the System
To display the running process in the current system, the “ps ef” command is utilized as below:
$ ps ef
The output shows the list of processes with the command line arguments passed to the processes.
Example 2: Display All Processes Belonging to a Specific User
To display all processes of the particular user, specify the “-u” option that represents the username such as “itslinuxfoss”:
$ ps ef -u itslinuxfoss
The output shows the list of the all running processes of “itslinuxfoss” user in the system.
Example 3: Display Processes With a Specific PID
We can display the specific process using the process id. For this, specify the “2542” id of the “firefox” process with the “p” option:
$ ps ef -p 2542
The output shows the details of a particular process based on the process id.
Example 4: Display Processes to a Specific Process Group
To display the processes associated with the same group, use the “-g” option with the process id:
$ ps ef -g 1250
The output returns the list of multiple processes with the same group.
Example 5: Display Processes With a Specific Terminal
To display the list of running processes with the specific terminal, utilize the “t” option as below:
$ ps ef -t tty2
Example 6: Display Processes Specific Session
For displaying processes that are associated with a particular session, execute the “-s” option as below:
$ ps ef -s 1250
The output returns the processes of a specific session.
Example 7: Display All Processes Except a Specific UID
To display all processes except those with a specific UID, use the “-U” option by specifying the username:
$ ps ef -U itslinuxfoss
The output displays all processes except “itslinuxfoss”.
Example 8: Display Processes Sorted by Memory Usage
To visualize the processes sorted by memory usage, use the “pmem” utility with the “o” option:
$ ps ef -o pmem
The output returns the processes that are sorted by memory usage.
Example 9: Display Processes by Start Timing
To display processes sorted by start time, use the “lstart” utility with the “-o” option as below:
$ ps ef -o lstart
The output returns the sorted list of processes that are recently started.
That is all from the “ps -ef” command in Linux.
Linux offers the “ps-ef” command that lists the running processes with the command line arguments passed to the process. Additionally, users can display all processes belonging to a specific user, specific PID, process group, specific session, sorted by memory usage, etc. This guide has explained the “ps-ef” command with possible examples.