The "ps" command in Linux is an abbreviation of "process status". It is used to get information about the processes running within your system. The output of this command can vary depending upon the parameters used with it.
Syntax
The general syntax of the "ps" command in Linux given below:
$ ps [parameter]
If you want to learn about the correct usage of the "ps" command before heading on to its examples, then you can access its "help" manual with the following command:
$ ps --help
Below are some examples of Using the "ps" Command in Linux
We will be sharing a few examples of using the "ps" command in Linux.
#1: Display the Processes Running in the Current Shell
If you wish to display the processes that are running in the current shell, then you should execute the "ps" command without any parameters as follows:
$ ps
#2: Display All the Currently Running Processes
You can also list down all the currently running processes of your Linux system with the following command:
$ ps –A
#3: Display All the Processes Associated with the Current Terminal
Specific processes are associated with the current terminal session. If you want to take a look at all such methods of your current terminal session, then you can execute the following command:
$ ps –T
#4: Display All the Processes Associated with a Particular User
You can even list down all the processes related to a particular user of your Linux system. To do so, you can execute the following command:
$ ps –u UserName
Here, you can replace UserName with the user's name whose associated processes you want to list down.
Example 5: Display All the Processes Associated with a Particular User Group
Similar to the example above, some processes are associated with a particular user group of your Linux system. You can even list down these processes with the execution of the following command:
$ ps –fG UserGroupName
Here, you can replace UserGroupName with the user group's name whose associated processes you want to list down.