How to view running processes in Linux?
In Linux system, you can use the following command to view the running processes:
- The ps command is used to view the list of currently running processes.
- ps aux: Display all processes of all users.
- ps -ef: display the detailed information of all processes.
- Display the process tree structure using ps -e –forest.
- The top command: dynamically displays information about the processes currently running in the system.
- After entering the top command in the terminal, you can press Shift + P to sort by CPU usage and Shift + M to sort by memory usage.
- htop command: similar to the top command, but offers more interactive features.
- You need to install htop first. Use the command sudo apt-get install htop to install it.
- pgrep command: used to find the PID of a process based on its name or other conditions.
- pgrep
: find the PID of a process based on its name. - pgrep -u
: Search for the process ID based on the username. - The pidof command is used to find the PID of a process based on its name.
- Find the PID of a process based on its name using “pidof”.
The above command can be further refined and sorted based on your needs using additional options.