In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "work management and system resources viewing methods in Linux". In daily operation, I believe that many people have doubts about work management and system resources viewing methods in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "work management and system resources viewing methods in Linux". Next, please follow the editor to study!
Part One work management
Job management refers to the behavior of managing multiple jobs at the same time in a single login terminal. Work management in Linux is, in short, the act of running work in the background. In windows, we often manage all kinds of work, and the common way to put work in the background is to minimize an application. So why manage the work? In windows, it's easy to understand that when we want to work on other tasks, we generally have to minimize the current work interface to make it easier to handle other tasks. Similarly, in Linux, for example, when we execute the cp command to copy a large file, if it is not executed in the background, we can only wait until the copy is complete before other work can be processed.
Before specifically talking about work management, we should first pay attention to the following:
The current terminal can only manage the work of the current terminal, not the work of other terminals.
Commands placed in the background need to run continuously for a period of time in order to capture and manipulate the job. For example, if we put the ls command in the background and we know that the ls is over after entering the carriage return, the meaning of putting it in the background does not exist.
Commands placed in the background cannot interact with the foreground or require input from the foreground, otherwise they can only be paused and cannot be run in the background. For example, the top command needs to interact with the foreground, and the vi/vim command edits the document and requires user input, and such commands are paused in the background and cannot be run in the background.
Specific methods:
(1) put the process in the background
The command is followed by the & character, which is used to put the command into the background, such as find /-name a & to find a file named an on the system.
After executing the command, ctrl+z pauses the command in the background. The most common, such as the top command, after executing the top, press ctrl+z in the interactive command, and the top is paused in the background.
(2) View the background work
Command: jobs [- l]
Option-l: the process number used to display the work
As shown in the figure, you can use the jobs command to view the previous top command that was paused in the background, and display its process number after adding the-l option. In the figure, the "+" sign indicates the work recently put in the background and the * job restored by default, and the "-" sign represents the last but one work put in the background.
(3) resume the work suspended in the background to the foreground for execution
Command: fg% work number
Parameter:% work number: work number is the value of the jobs command output information * * column, not the process number, preceded by a% sign to distinguish the two,% can be omitted.
As shown in the above figure, after the execution of the command fg% 1, the background work with work number 1 will be restored to the foreground, and if no parameters are added, the fg command will resume work with the sign "+" by default.
(4) resume the work suspended in the background to be executed in the background
Command: bg% work number
The command resumed in the background cannot interact with the foreground, otherwise it cannot be resumed to be executed in the background.
(5) the background command is executed without terminal.
When we need to execute the background command away from the terminal, we can use the nohup command in the format of nohup [command] &.
Part Two system resource view
System resource view is used to view the usage of various resources in the system. By viewing the system resources, you can understand the current resource usage of the system, so as to monitor the current health status of the system.
(1) vmstat command to monitor system resources
Format: vmstat [refresh delay] [refresh times]. For example, vmstat 1 / 3 means that it is refreshed every 1 second, for a total of three times.
Focus on the output information:
Procs: process information field
-r: the number of processes waiting to run. The higher the value, the busier the system.
-b: the number of processes that cannot be awakened. The higher the value, the busier the system.
Memory: memory information field
-swpd: virtual memory usage (in KB).
-free: free memory capacity (in KB).
-buff:
-cache:
Swap: exchange partition information field
-si: the size of data swapped from disk to memory, in KB.
So: the size of data swapped from memory to disk, in KB. The higher the value, the more frequent the system switching and the worse the performance.
Io: disk read and write information field
-bi: the size of the data read from the block device, in fast units.
-bo: write to the data size of the block device, in blocks. The higher the number, the busier the system IO.
System: system information field
-in: the number of processes interrupted per second.
-cs: the number of event switches per second.
Cpu:
-us: the percentage of cpu computing time consumed by non-kernel processes.
-sy: the percentage of cpu computing time consumed by kernel processes.
-id: the percentage of idle cou.
-wa: the percentage of cpu consumed by waiting for Imax O.
-st: the proportion of cpu embezzled by virtual machines.
(2) Kernel detection information when dmesg boots
Format: dmesg. Due to too much kernel information, it is often used in conjunction with grep, such as dmesg | grep CPU to view CPU information.
(3) free command to check memory usage status
Format: free [- b |-k |-m |-g]
Options:
-b: displayed in bytes.
-k: displayed in KB (default).
-m: displayed in MB.
-g: displayed in GB.
Output information: * Line: total is the total memory, used is used memory, free is free memory, shared is shared memory for multiple processes, buffres is buffer memory, and cached is cache memory. The second line: the amount of memory of-/ buffers/cache, which is equivalent to the used-buffers-cached of the bottom line. The amount of memory of + / buffers/cache, which is equivalent to the free+buffers+cached of the * * line. The third line: total is the total number of swap, used is the number of swap used, and free is the number of free swap.
(4) View CPU information
Command: cat / proc/cpuinfo
(5) the uptime command shows the startup time and average load of the system, that is, the * * line of the top command, which can also be seen in the w command.
(6) View system and kernel related information
Command format: uname [- a |-r |-s]
Options:
-a: view all relevant information about the system.
-r: check the kernel version.
-s: check the kernel name.
(7) judging the current number of digits of the system
Command: file / bin/ls
Determine the number of bits of the operating system by looking at the ls command.
(8) query the current release version of the Linux system
Command: lsb_release-a
At this point, the study of "work management and system resources viewing methods in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.