Detailed description of Linux work management and system resources, and detailed description of linux

Source: Internet
Author: User
Tags dmesg

Detailed description of Linux work management and system resources, and detailed description of linux

Part One Work Management

Work Management refers to managing multiple jobs at the same time on a Single login terminal. In Linux, work management is simply a process of putting work in the background. In windows, we often manage various jobs. The common way to put jobs in the background is to minimize an application. So why should we manage our work? In windows, this is easy to understand. When we want to operate other jobs, we generally only need to minimize the current work interface to facilitate other work. Similarly, in Linux, If we execute the cp command to copy a large file, if we do not place it in the background for execution, we can only wait until the copy is complete to process other work.

Before talking about work management, we should first note the following:

Specific Method:

(1) Put the process in the background

  • After the command is followed by the & operator, it is used to put the command into the background for execution, for example, find/-name a & find the file named a in the system.
  • Run the command ctrl + z to pause the command in the background. The most common is the top command. After the top Command is executed, press ctrl + z in the interactive command to pause the top command in the background.

 

(2) view background work

  • Command: jobs [-l]
  • Option-l: displays the Worker Process number.

Run the jobs command to view the top command that was previously paused in the background, and add the-l option to display the process number. In the figure, "+" indicates the work recently put into the background, and is also the first job to be restored by default. "-" indicates the work of putting the last and second to the background.

 

(3) resume the background pause to the foreground for execution.

  • Command: fg % work number
  • Parameter: % worker ID: The worker ID is the value in the first column of the output information of the jobs command. It is not the process ID. % is used to distinguish the two. % can be omitted.

As shown in, after the command fg % 1 is executed, the background work with the working number 1 will be resumed to the foreground. If no parameter is added, the fg command will resume work with the "+" by default.

 

(4) resume the paused work in the background to be executed in the background.

  • Command: bg % work number

Commands executed in the background cannot interact with the foreground; otherwise, they cannot be executed in the background.

 

(5) run background commands without Terminals

When we need to run the background commands out of the terminal, we can use the nohup command in the format of nohup [command] &.

 

 View Part Two system resources

System resource view is used to view the usage of various system resources. By viewing system resources, you can view the current resource usage of the system and monitor the current health status of the system.

(1) vmstat command to monitor system resources

  • Format: vmstat [refresh latency] [refresh times]. For example, vmstat 1 3 indicates refresh once every 1 s and refresh three times in total.

Focus on output information:

  • Procs: Process Information Field
    • -R: Number of processes waiting for running. The greater the value, the more busy the system.
    • -B: Number of processes that cannot be wakened. The greater the value, the more busy the system is.
  • Memory: memory Information Field
    • -Swpd: virtual memory usage, in KB.
    • -Free: idle memory capacity, in KB.
    • -Buff:
    • -Cache:
  • Swap: swap partition information field
    • -Si: The size of data transferred from the disk to the memory, in KB.
    • So: The size of data transferred from memory to disk, in KB. The larger the value, the more frequent the system exchange and the worse the performance.
  • Io: disk read/write Information Field
    • -Bi: The size of data read from Block devices. The unit is fast.
    • -Bo: The data size written to the block device. Unit: block. The greater the value, the more busy the system IO.
  • System: system Information Field
    • -In: The number of interrupted processes per second.
    • -Cs: the number of event switches per second.
  • Cpu:
    • -Us: Percentage of cpu computing time consumed by non-kernel processes.
    • -Sy: Percentage of cpu computing time consumed by kernel processes.
    • -Id: Percentage of idle cou.
    • -Wa: Percentage of cpu consumed by waiting for I/O.
    • -St: cpu shares stolen by virtual machines.

 

(2) kernel detection information during dmesg startup

  • Format: dmesg. Because the kernel information is too large, it is often used in combination with grep, such as dmesg | grep CPU to view CPU information.

 

(3) run the free command to check the memory usage status.

  • Format: free [-B |-k |-m |-g]
  • Option:
    • -B: In bytes.
    • -K: the unit is KB. The default value is KB.
    • -M: displayed in MB.
    • -G: in GB.

  • Output Information: The first line is total memory, used is used memory, free is idle memory, shared memory is shared for multiple processes, buffres is the buffer memory, and cached is the cache memory. Row 2:-/buffers/cache memory, which is equivalent to used-buffers-cached in the bottom row. +/Buffers/cache memory, which is equivalent to free + buffers + cached in the first line. Row 3: total indicates the total number of swap instances, used indicates the number of swap instances in use, and free indicates the number of idle swap instances.

 

(4) view CPU Information

  • Command: cat/proc/cpuinfo

 

(5) The uptime command displays the system startup time and average load, that is, the first line of the top command, which can be seen in the w command.

 

(6) view system and kernel information

  • Command Format: uname [-a |-r |-s]
  • Option:
    • -A: view all information about the system.
    • -R: view the kernel version.
    • -S: view the kernel name.

 

(7) judge the current number of digits of the system

  • Command: file/bin/ls

Use the ls command to determine the number of digits of the operating system.

 

(8) query the current Linux system release version

  • Command: lsb_release-

 

 

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.