How do I see all running process in Linux operating systems using command line or GUI options? How can I show all running Processes in Linux operating system?
Introduction: A process is nothing but tasks within the Linux operating system. A process named httpd used to display web pages. Another process named mysqld provides database service. You need to use the ps command. It provides information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support the ps command to display information about all running process. The ps command gives a snapshot of the current processes. If you want a repetitive update of this status, use top, atop, and htop command as described below.
Linux commands show all running processes
Apart from ps command, you can also use the following commands to display info about processes on Linux operating systems:
- top command : Display and update sorted information about Linux processes.
- atop command : Advanced System & Process Monitor for Linux.
- htop command : Interactive process viewer in Linux.
- pgrep command : Look up or signal processes based on name and other attributes.
- pstree command : Display a tree of processes.
How to list process with the ps command
Type the following ps command to display all running process:
# ps -aux | less
# ps aux | less
- A : Select all processes
- u : Select all processes on a terminal, including those of other users
- x : Select processes without controlling ttys
See every process on the Linux system
Either pass -A or -e option to show all processes on your server/workstation powered by Linux:
# ps -A
# ps -e
How to see every process except those running as root
To negates the selection pass the -N or --deselect option to the ps command:
# ps -U root -u root -N
# ps -U root -u root --deselect
See process run by user vivek
Select by process by effective user ID (EUID) or name by passing username such as vivek:
# ps -u vivek
Linux running processes with top command
The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
To quit press q, for help press h.
How to display a tree of processes
The pstree command shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.
Print a process tree using ps
# ps -ejH
# ps axjf
Get info about threads
Type the following command:
# ps -eLf
# ps axms
Task: Get security info
Type the following command:
# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axZ
# ps -eM
How to save process snapshot to a file
How to lookup process by name
Use pgrep command command. It looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example, display firefox process id:
$ pgrep firefox
Following command will list the process called sshd which is owned by a user called root:
$ pgrep -u root sshd
Say hello to htop and atop
htop is interactive process viewer just like top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. To install htop on a Debian/Ubuntu Linux, type the following apt-get command/apt command:
# apt-get install htop
or use the yum command to install htop on a CentOS/RHEL:
# yum install htop
Now type the htop command at the shell prompt:
The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network. It also shows which processes are responsible for the indicated load with respect to cpu- and memory load on process level; disk- and network load is only shown per process if a kernel patch has been installed. Type the following command to start atop:
- Kill process in Linux or terminate a process in UNIX or Linux systems
- Man pages: atop(1)
Linux processes carry out various tasks/jobs within the Linux distribution. Since Linux is a multiprocessing operating system, one can run multiple tasks in the background. Hence it is essential to know how to show all running processes in Linux.