What is ‘ps’ command in linux for?

The ps command in Linux is used to display information about the currently running processes on a system. It shows information about the processes that are running in the foreground as well as the background.

Here’s an example of how to use the ps command:

$ ps aux

The ps aux command displays a list of all running processes in a detailed format. The output of the command may look like this:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2 169088 10248 ?        Ss   Feb24   0:02 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Feb24   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        I<   Feb24   0:00 [rcu_gp]
root         4  0.0  0.0      0     0 ?        I<   Feb24   0:00 [rcu_par_gp]
root         6  0.0  0.0      0     0 ?        I<   Feb24   0:00 [kworker/0:0H-events_highpri]

The columns in the output provide information about the user who owns the process, the process ID (PID), the percentage of CPU usage, the percentage of memory usage, the virtual memory size (VSZ), the resident set size (RSS), the terminal associated with the process (TTY), the process state (STAT), the start time, and the command that was used to start the process.

The ps command can be used with various options to customize the output and display specific information about the running processes. For example, the ps auxf command shows a tree view of the running processes, while the ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu command shows only the process ID, parent process ID, command, CPU usage, and memory usage, sorted by CPU usage in descending order.

In summary, the ps command is a powerful tool that provides detailed information about the running processes on a Linux system and is useful for monitoring system performance and troubleshooting issues.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top