For example, if you have an application that is locked up or unresponsive and gobbling up all your CPU time and/or RAM, you can use the ps command to look up the application process and kill the process to restore the system to its normal operation. For students or new users looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners. Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices. About the ps command: The ps command is a command line utility that helps you view details of currently-running processes with options to kill or terminate processes that are not behaving normally. Syntax: The syntax is the rule and format of how the ps command can be used. These syntax options can be reordered, but a straight format must be followed.,. Below is an example syntax of how to use the ps command. Options: The command line options are switches or flags that determined how the commands are executed or controlled. they modify the behavior of the commands. they are separated by spaces and followed after the commands. Below are some options for the ps command: Examples: Below are some examples of how to run and use the ps on Ubuntu Linux. Simply run the ps to invoke it. Running the ps command without options will display a list of processes started by the account running the command. These represent the columns.
PID: The process ID number of the running process. TTY: The console name the user is logged in at. TIME: The CPU processing time used by the process. CMD: The command name that started the process
For example, if you want to list all processes currently running on the system, even those started by other users, simply run the ps command with the -e or -A option. Example: This will list all the processes running, but the list is going to be long. So pipe the command with less to break the list by the screen. Example: You should see something similar to the list below: When you want to know more details of running processes, including displaying their parent processes, simply run the ps command with the options: Example: This will display processes along with their parents This list all processes using the full-format use the ps command with the -ef option Example: You should see a similar list as shown below: These represent the column:
UID: The process owner user ID. PID: The process ID. PPID: Parent process ID. C: The number of children the process has. STIME: Start time of the process. TTY: The console name of the user who started. TIME: The CPU processing time used. CMD: The command name or process name
Killing a process
To kill a process, simply run the kill followed by the process ID ( PID): Example: To kill a process by name, use the kill command followed by the process name: Example: You can also use the killall command to kill all the processes along with their child processes That’s it! Congratulations! You have learned how to use the ps command on Ubuntu Linux