PS Command in Linux: In Linux, a program that is currently running is called process. You may need to find out what processes are ongoing while working on a Linux system. Here is the PS Command to find information about the running processes. The ps command, a short form of “Process Status”, used to view the information related to the currently running processes. It displays the list of processes with their PIDs along with details depends on diverse options. This command provides several options for manipulating the output as per our needs. This article describes how to make use of the PS Command Linux and its options with relevant examples.
- General Syntax of “ps” command
- How to use PS Command?
- Examples to use “ps” command
- PS Command – Options
- Get help from ps command
- Check ps command version
- A Short Summary
General Syntax of “ps” command:
The formal syntax for ps command is as follows:
How to use PS Command?
Execute the below command in order to view list of processes for the current shell.
The output contains four columns of information labeled PID, TTY, TIME and CMD.
- PID: It is the process id that is considered to be important for a user. It allows you to kill any crash process.
- TTY: It is the terminal type that the user logged into.
- TIME: CPU utilization time in minutes and seconds for the running process. Sometimes TIME shows 00:00:00 and it indicates no CPU time has been given by the kernel.
- CMD: The name of the command that was used to begin the process.
Examples to use “ps” command:
Let’s look out some examples of using the ps command with the available options.
To view all processes:
You have to use either of the following options in order to view all processes running on your system.
To view running processes:
To Show true command name:
PS Command – Options:
- UNIX options – which may be organized and must be prefaced by a dash(“-“).
- BSD options – Must not be used with a dash.
- GNU options – Preceded by two dashes(“–“).
Basic options: -A, -e all processes -a all with tty, except session leaders a all with tty, including other users -d all except session leaders -N, --deselect negate selection r only running processes T all processes on this terminal x processes without controlling ttys
Selection by list: -C <command> command name -G, --Group <GID> real group id or name -g, --group <group> session or effective group name -p, p, --pid <PID> process id --ppid <PID> parent process id -q, q, --quick-pid <PID> process id (quick mode) -s, --sid <session> session id -t, t, --tty <tty> terminal -u, U, --user <UID> effective user id or name -U, --User <UID> real user id or name The selection options take as their argument either: a comma-separated list e.g. '-u root,nobody' or a blank-separated list e.g. '-p 123 4567'
Output formats: -F extra full -f full-format, including command lines f, --forest ascii art process tree -H show process hierarchy -j jobs format j BSD job control format -l long format l BSD long format -M, Z add security data (for SELinux) -O <format> preloaded with default columns O <format> as -O, with BSD personality -o, o, --format <format> user-defined format s signal format u user-oriented format v virtual memory format X register format -y do not show flags, show rss vs. addr (used with -l) --context display security context (for SELinux) --headers repeat header lines, one per page --no-headers do not print header at all --cols, --columns, --width <num> set screen width --rows, --lines <num> set screen height
Show threads: H as if they were processes -L possibly with LWP and NLWP columns -m, m after processes -T possibly with SPID column
Miscellaneous options: -c show scheduling class with -l option c show true command name e show the environment after command k, --sort specify sort order as: [+|-]key[,[+|-]key[,...]] L show format specifiers n display numeric uid and wchan S, --cumulative include some dead child process data -y do not show flags, show rss (only with -l) -V, V, --version display version information and exit -w, w unlimited output width --help <simple|list|output|threads|misc|all> display help and exit
Get help from ps command:
In order to get help from the ps command, you have to execute any one of the following commands on the Ubuntu Terminal.
Check ps command version:
In order to check the ps command version, use any one of the below commands.
A Short Summary:
We hope that this article about the usage of PS Command Linux Ubuntu 19.10 Eoan Ermine/ 18.04 LTS Bionic Beaver helped you clearly. Besides, we have listed all available options associated with the command so it will assist you with no doubts. We will be happy and motivated if you share your valuable feedback about this article.