ps command in Linux means ps displays information about a selection of the active processes.

Syntax
ps [options]
On the man page, the describes it
- ps – report a snapshot of the current processes.
- man ps – More details information about ps command.
ps command in Linux with Examples
$ ps
Display User Running Processes
[vagrant@DevopsRoles ~]$ ps -X #To display a user’s processes by real user ID (RUID) [vagrant@DevopsRoles ~]$ ps -fU vagrant
Display Group Processes
[vagrant@DevopsRoles ~]$ ps -fG vagrant
print a process tree for a given process
[vagrant@DevopsRoles ~]$ ps -ef --forest | grep -v grep | grep sshd root 2414 1 0 06:38 ? 00:00:00 /usr/sbin/sshd -D -u0 root 4087 2414 0 06:39 ? 00:00:00 _ sshd: vagrant [priv] vagrant 4090 4087 0 06:39 ? 00:00:00 _ sshd: vagrant@pts/0
Print Process Threads
[vagrant@DevopsRoles ~]$ ps -fL -C sshd UID PID PPID LWP C NLWP STIME TTY TIME CMD root 2414 1 2414 0 1 06:38 ? 00:00:00 /usr/sbin/sshd -D -u0 root 4087 2414 4087 0 1 06:39 ? 00:00:00 sshd: vagrant [priv] vagrant 4090 4087 4090 0 1 06:39 ? 00:00:00 sshd: vagrant@pts/0 root 4730 2414 4730 3 1 07:17 ? 00:00:00 sshd: vagrant [priv] vagrant 4733 4730 4733 0 1 07:17 ? 00:00:00 sshd: vagrant@pts/1
To view the PID, PPID, user name, and command of a process.
[vagrant@DevopsRoles ~]$ ps -eo pid,ppid,user,cmd | grep vagrant 4087 2414 root sshd: vagrant [priv] 4090 4087 vagrant sshd: vagrant@pts/0 4091 4090 vagrant -bash 4730 2414 root sshd: vagrant [priv] 4733 4730 vagrant sshd: vagrant@pts/1 4734 4733 vagrant -bash 4770 4091 vagrant ps -eo pid,ppid,user,cmd 4771 4091 vagrant grep --color=auto vagrant
Find top running processes by highest memory and CPU usage in Linux.
[vagrant@DevopsRoles ~]$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head PID PPID CMD %MEM %CPU 2413 1 /usr/bin/python2 -Es /usr/s 3.4 0.0 1666 1 /usr/sbin/NetworkManager -- 1.7 0.0 1502 1 /usr/lib/polkit-1/polkitd - 1.6 0.0 1 0 /usr/lib/systemd/systemd -- 1.2 0.0 4730 2414 sshd: vagrant [priv] 1.1 0.0 4087 2414 sshd: vagrant [priv] 1.1 0.0 2359 1666 /sbin/dhclient -d -q -sf /u 1.0 0.0 1076 1 /usr/lib/systemd/systemd-ud 0.9 0.0 2418 1 /usr/sbin/rsyslogd -n 0.9 0.0 [vagrant@DevopsRoles ~]$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head PID PPID CMD %MEM %CPU 1 0 /usr/lib/systemd/systemd -- 1.2 0.0 2 0 [kthreadd] 0.0 0.0 3 2 [ksoftirqd/0] 0.0 0.0 5 2 [kworker/0:0H] 0.0 0.0 6 2 [kworker/u2:0] 0.0 0.0 7 2 [migration/0] 0.0 0.0 8 2 [rcu_bh] 0.0 0.0 9 2 [rcu_sched] 0.0 0.0 10 2 [lru-add-drain] 0.0 0.0
Conclusion
ps command in Linux is a simple command in Linux. It is the most popular in use terminal Linux report a snapshot of the current processes