In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how the linux system to view the system process, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
Introduction to the Linux process:
In linux, each running program is called a process, and each process is assigned an ID number
Each process corresponds to a parent process. This parent process can copy multiple child processes, such as wwwserver
Every process can exist in two ways, foreground and background. The so-called foreground process is what the user can operate on the current screen, while the background process is actually operating. But because of the processes that cannot be seen on the screen, they usually run in the background.
In general, the services of the system exist in the form of background processes. And will be resident in the system until the computer is turned off.
Linux system View system process method:
You can use the ps command. It can display information about the currently running process, including the PID of the process. 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
Among them
-A: show all processes
A: displays all processes that include other users in the terminal
X: displays the process without a controlled terminal
Task: view each process in the system.
# ps-A # ps-e
Task: view processes that are not running on root
# ps-U root-u root-N
Task: view the processes run by the user vivek
# ps-u vivek
Top command
The top command provides a dynamic real-time view of the running system. At the command prompt, enter top:
# top
Output:
Figure 1:top command: display Linux task
Press Q to exit and h to help.
Displays a tree view of the process
Pstree displays running processes in a tree. The root node of the tree is pid or init. If a user name is specified, the process tree takes the process owned by the user as the root node.
$pstree
Sample output:
Figure 2:pstree-A tree view showing the process
Task: print the process tree using ps
# ps-ejH# ps axjf
Task: get thread information
Enter the following command:
# ps-eLf# ps axms
Task: get security information
Enter the following command:
# ps-eo euser,ruser,suser,fuser,f,comm,label# ps axZ# ps-eM
Task: save the process snapshot to a file
Enter the following command:
# top-b-N1 > / tmp/process.log
You can also email yourself the results:
# top-b-N1 | mail-s' Process snapshot' you@example.com
Task: find the process
Use the pgrep command. Pgrep can find the currently running processes and list the eligible processes ID. For example, the process ID that displays the firefox:
$pgrep firefox
The following command displays the process with the name sshd and owner root.
$pgrep-u root sshd
Say hello to htop and atop
Htop is an interactive process viewer similar to top, but you can scroll vertically and horizontally to view all processes and their command line. PID is not required for the related operation (killing,renicing) of the process. To install the htop input command:
# apt-get install htop
Or
# yum install htop
At the command prompt, enter htop:
# htop
Sample output:
Figure 3:htop-Interactive Linux / UNIX process viewer
Atop tool
Atop is an interactive monitoring tool for viewing the load of a Linux system. It shows the use of critical hardware resources at the system level (from a performance perspective), such as CPU, memory, hard drives, and networks.
It can also show which process is causing a specific load based on process-level CPU and memory load; if kernel patches have been installed, it can show the hard disk and network load of each process. Enter the following command to start atop:
# atop
Sample output:
The above is all the contents of the article "how to check the process of the linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.