The LinuxTOP command is sorted by memory usage and by CPU usage
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
The LinuxTOP command sorts processes by memory usage and by CPU usage P & amp; ndash; lists processes in the order of CPU usage M & amp; ndash; the process list is arranged in the order of memory usage. during system maintenance, you may need to check the CPU usage at any time... linux TOP commands are sorted by memory usage and by CPU usage P-process list in the order of CPU usage M-process list in the order of memory usage during system maintenance, you may need to check the CPU usage at any time and analyze the system status based on the corresponding information. In CentOS, you can use the top command to view CPU usage. After running the top command, the CPU usage status will be displayed in full screen mode and in dialog mode-the top-based command can be used to control the display mode. The command to exit top is q (press q once in top running ). Enter "top" in the command line to start top. The full-screen dialog mode of top can be divided into three parts: system information, command input, and process list. Part 1-system information column at the top: line 1 (top): "14:55:59" indicates the current time of the system; "4 days," indicates the current operating time after the system is started; "1 user" is the user Currently logged on to the system, more specifically, the number of terminals that log on to a user-the number of terminals that a user connects to multiple terminals in the system at the same time is considered as multiple users connecting to the system, the number of users here will also be the number of terminals; "load average" is the average value of the current system load, the following three values are the average number of processes one minute ago, five minutes ago, and 15 minutes ago. Generally, when this value exceeds the number of CPUs, the CPU is hard to load the processes in the current system. The second line (Tasks): "12 total" indicates the total number of processes in the current system; "1 running" indicates the number of processes in the current running state; "11 sleeping" indicates the number of processes in the waiting state; "0 stoped" indicates the number of stopped system processes; and "0 zombie" indicates the number of recovered processes; the third line (Cpus) indicates The current CPU usage. row 4 (Mem) indicates the total memory usage, current usage, idle memory usage, and buffer memory usage. row 5 (Swap ): indicates that the category is the same as the fourth row (Mem), but this shows the usage of Swap partition (Swap. In general, Swap partitions (Swap) are frequently used and are considered to be caused by insufficient physical memory. Part 2-internal command prompt bar in the middle section: you can use the top internal command to control the display mode of processes during top running. The internal commands are as follows: s-change the screen update frequency l-close or enable the first line of top information in the first line t-close or enable the first part of the second line of Tasks and the third line of Cpus Information m-close or enable the expression N of the first part of the fourth line Mem and the fifth line Swap information. in the order of PID size, the process List P is displayed. in the order of CPU usage, the process list M is displayed. sequential process List of memory usage size h-show help n-set the number of processes displayed in the process List q-exit tops-change screen update cycle part 3-process in the bottom list bar: the process list differentiated by PID is regularly updated based on the set screen update time. You can use the top internal command to control the display mode. In general, we maintain the server through remote monitoring, so that the local terminal of the server runs top in real time, which is one of the fast and convenient ways to monitor the server status locally on the server. Ubuntu process management method ps display current process ps-l display details ps-u display relevant fields in user format description F process status Mark S process status code UID process performer id ppid parent process parent process ID) the nice value of the PRI process execution priority (priority) NI process execution priority, negative value indicates the memory occupied by the SZ process with a higher priority. the address % CPU usage % MEM memory usage % VSZ occupied virtual memory size RSS occupied physical memory size START process START time kill delete process kill pid delete process of the specified pid kill-l view all available signals kill-9 pid force delete process, the SIGKILL signal kill-15 pid is sent to force the process to be deleted, and the SIGTERM signal kill-HUP pid is sent to restart Deam On process free View memory usage status free-s 10 check memory usage every 10 seconds nice set execution priority,-20 ~ 19,19 the lowest sudo nice-2 vi sets the vi priority to-2 renice to modify the execution priority,-20 ~ 19,19 lowest top dynamic display process sort by "P" key by CPU usage time sort by "M" key sort by memory usage sort by "T" key sort by execution time sort by "u" key monitoring specific users press the K key to delete the process top-d 10 specify the update time lsof-p view the files opened by the process jobs Command View background job ubuntu end process method 1 open Terminal 2, knock ps-ef to find the process number (that is, the PID column) 3. press the kill PID (if the PID is 123456, then kill 123456). 4. when the local Ubuntu Linux system runs large software, or the server runs for a long time, some software with design defects may lead to false positives! What should we do after the program is suspended? In fact, this problem is simple and simple. it's okay to end the process directly! Just like what we do in Windows! Next we will introduce several methods to end processes under Ubuntu Linux! The safest way to kill a process is to use the kill command without a modifier or a flag. First, use the ps-ef command to determine the PID of the process to be killed, and then enter the following command: # kill-pid note: The standard kill Command can usually achieve the goal. Terminate the problematic process and release the process resources to the system. However, if a child process is started and only the parent process is killed, the child process is still running and consumes resources. To prevent these so-called "zombie processes", ensure that all child processes are killed before the parent process is killed. You can also use the following command to determine the PID or PPID # ps-ef | grep httpd of the process to be killed to end the process in the most elegant way # kill-l PID-l option to tell kill Command end the process as if the user who started the process had logged out. When this option is used, the kill Command also tries to kill the left child process. But this command is not always successful-you may still need to manually kill the child process and then kill the parent process. The TERM signal sends a TERM signal to the parent process, trying to kill it and its child process. # Kill-term ppid killall command to kill all processes in the same process Group. It allows you to specify the name of the process to be terminated, rather than the PID. # Killall httpd: stop and restart a process. sometimes, you only want to simply stop and restart the process. Run the following command: # kill-hup pid to shut down Linux's slow execution process and restart it immediately. This command is convenient when you configure the application. you can execute this command when you need to restart the process after modifying the configuration file. Kill-9 PID-approved kill-s SIGKILL this powerful and dangerous command forces the process to terminate suddenly at runtime, and the process cannot be self-cleaned after it ends. The hazard is that the system resources cannot be released normally. it is generally not recommended unless other methods are ineffective. When using this command, you must use ps-ef to confirm that no zombie process is left. Only the parent process can be terminated to eliminate zombie processes. If the Zombie process is adopted by init, the problem will be serious. Killing the init process means shutting down the system. If there is a zombie process in the system, and its parent process is init, and the Zombie process occupies a large amount of system resources, you need to restart the machine at some time to clear the process.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.