Linux command to List currently Running Processes
A file is everything in Linux. When a file is executed, it is understood as a process. Process is created by another process and gets destroyed after being used. Multiple processes can run on Linux system and various commands are specified for management of process. Each process is identified by a unique number called Process-ID (PIDwhich is allocated while the process is created. from the parentPID.If you execute any single command from shell terminal, it also creates a process. Refer the tutorial Process in Linux for more information about process.
Here I will explain various process commands which give out the information about running process.
Ps Command (Process Status)
The ps command displays the same process attributes owned by user running command.
Open the command terminal by typing the following command and press enter key:
ps
The following output is displayed on screen:
PID TTY TIME CMD
2637 pts/1 00:00:00 bash
5505 pts/1 00:00:00 ps
Each line displays the information like process ID (PID), terminal with which process is associated (TTY), processor time (TIME) and name of process (CMD).
here first line (expecting header line) is the process information of login shell and another line is process information of ps command.
Full listing of current running process
The full listing of current running process includes information of parent of every process and user.
Command: ps<hyphen><-f>
f option indicates the full listing
Type from command terminal:
ps -f
The following output is displayed on screen:
UID PID PPID C STIME TTY TIME CMD
ashish 2637 2629 0 06:16 pts/1 00:00:00 bash
ashish 5647 2637 0 10:53 pts/1 00:00:00 ps –f
List of all current running and system process
The list of all current running processes includes user and system process.
Command: ps<hyphen><-e>
The -e option indicates all processes including both user and system processes.
Type from command terminal:
ps -e
The following output is displayed on screen:
PID TTY TIME CMD
1 ? 00:00:03 init
2 ? 00:00:00 kthreadd
3 ? 00:00:01 ksoftirqd/0
5608 ? 00:00:00 kworker/u16:0
5664 ? 00:00:00 kworker/u16:2
5668 pts/1 00:00:00 ps
Note: process information changes on different system according to Linux distributor.
Process belong to specific user
The system administrator can get the user activity using ps command. The ps command is provide the list of process which is associated with specific user.
Command: ps<hyphen><-u><hyphen><name of user>
The -u option displays the process of specific user.
Type from command terminal:
ps -u ashish
Note: here ashish is the user name of system
The following output is displayed on screen:
PID TTY TIME CMD
1816 ? 00:00:00 gnome-keyring-d
1852 ? 00:00:00 init
1952 ? 00:00:00 dbus-daemon
1963 ? 00:00:00 upstart-event-b
1975 ? 00:00:00 window-stack-br
List the process based on PID or PPID
Sometimes we want to know about the child process associated with specific parent process where they are born. The option –ppid used for child process information of specific parent id and –pid option provide the full information of specific child process.
Command: ps<hyphen><–ppid or –pid><hyphen><PPID or PID of process>
Type from command terminal:
ps –ppid 1
Note: here 1 is main system process which is the parent of various child processes.
The following output is displayed on screen:
PID TTY TIME CMD
264 ? 00:00:00 upstart-udev-br
271 ? 00:00:00 systemd-udevd
403 ? 00:00:00 dbus-daemon
446 ? 00:00:00 systemd-logind
457 ? 00:00:00 rsyslogd
459 ? 00:00:00 bluetoothd
531 ? 00:00:01 avahi-daemon
634 ? 00:00:00 ModemManager
663 ? 00:00:00 upstart-file-br
Now, enter the command for specific child process information in full format:
ps -f –pid 634
The following output is displayed on screen:
UID PID PPID C STIME TTY TIME CMD
root 634 1 0 09:47 ? 00:00:00 /usr/sbin/ModemManager
Tree structure of process
Processes are associated with each other in hierarchical manner. Each process can be the parent of child process or child process of parent process. The system administrator can get the process tree based on PID.
Command: pstree<hyphen>PID of process>
Type from command terminal:
ps –ppid 1
Note: here 1 is main system process which is the parent of various child processes.
The following output is displayed on screen:
init─┬─ModemManager───2*[{ModemManager}]
├─NetworkManager─┬─dhclient
│ ├─dnsmasq
│ └─3*[{NetworkManager}]
├─accounts-daemon───2*[{accounts-daemon}]
├─acpid
├─avahi-daemon───avahi-daemon
├─bluetoothd
├─colord───2*[{colord}]
├─cron
├─cups-browsed
├─cupsd
├─cupsd───dbus
Note: process information changes on different system according to Linux distributor.
You may also like:
Filed Under: Featured Contributions, Tutorials
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.