You can use the ps command. It can display relevant information about the currently running process, including the process's PID. Both Linux and UNIX support the ps command, which displays information about all running processes. The ps command provides a snapshot of the current process. If you want the status to refresh automatically, you can use the top command. ps Command Enter the following ps command to display all running processes: # ps aux | less in, -A: Display all processes a: Display all processes in the terminal including those of other users x: Display processes without a controlling terminal Task: View every process in the system. # ps -A # ps -e Task: View processes running as non-root # ps -U root -u root -N Task: View the processes run by user vivek ps -u vivek Task: top command The top command provides a dynamic real-time view of a running system. Type top in the command prompt: # top Output: Press q to exit, press h to enter help. Task: Display a tree view of the process. pstree displays the running processes in a tree format. The root node of the tree is pid or init. If a username is specified, the process tree will be rooted at processes owned by that user. $ pstree Sample output: Task: Use ps to print the process tree # ps -ejH # ps axjf Task: Get thread information Enter the following command: # ps -eLf # ps axms Mission: Get security information Enter the following command: # ps -eo euser,ruser,suser,fuser,f,comm,label # ps axZ # ps -eM Task: Save process snapshot to file Enter the following command: # top -b -n1 > /tmp/process.log You can also email the results to yourself: # top -b -n1 | mail -s 'Process snapshot' [email protected] Use the pgrep command. pgrep can find currently running processes and list the process IDs that meet the conditions. For example, to display the process ID of Firefox: Task: Find Process $ pgrep firefox The following command will display the process named sshd and owned by root. $ pgrep -u root sshd Say hello to htop and atop htop is an interactive process viewer similar to top, but with vertical and horizontal scrolling to view all processes and their command lines. Process related operations (killing, renicing) do not require input of PID. To install htop enter command: # apt-get install htop or # yum install htop Type htop in the command prompt: # htop atop tool atop is an interactive monitoring tool for viewing Linux system load. It shows the usage of key hardware resources (from a performance perspective) at the system level, such as CPU, memory, disk, and network. It can also show which processes are causing a certain load based on CPU and memory load at the process level; and can show disk and network load per process if the kernel patch has been installed. Enter the following command to start atop: This is the end of this article about how to view all running processes in Linux. For more information about viewing running processes in Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: JavaScript functional programming basics
>>: MySQL's method of dealing with duplicate data (preventing and deleting)
The specific steps of installing mysql5.7.18 unde...
Table of contents rem vw Adapt to third-party UI ...
Copy code The code is as follows: <select> ...
Preface Since MySQL 5.1.6, a very unique feature ...
Table of contents Preface start step Troubleshoot...
Recently, I encountered a database with the follo...
Good morning everyone, I haven’t updated my artic...
Table of contents Preface Check Constraints Creat...
background Recently, I executed a DML statement d...
Table of contents 1. Redux 1.1. Store (librarian)...
1. Check the PHP version after entering the termi...
<br />It has been no more than two years sin...
In the following example, when the width of the td...
Copy code The code is as follows: <div content...
First, a common question is, what is the relation...