Commands for daily management of Linux systems

Source: Internet
Author: User
Tags system log

1, monitoring the load of the system  

W View the current system load, detailed display the host running time, the number of logged on users, the system average load information;

Uptime view current system load and host running time, simple display;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6B/7E/wKioL1UvYZHigOXsAAHn Or2 dklm806.jpg "title=" W.jpg " Style= "Float:left;" alt= "Wkiol1uvyzhigoxsaahn Or2 dklm806.jpg"/>






Display Description:

17:30:02// system current time;

Up 8:06//host has run time, the greater the time, the more stable the machine.

3 users//user connections (is the total number of connections, not the number of users)

load average:0.05, 0.08, 0.02 //System average load, statistics the average load of the system in the last 1, 5, 15 minutes;

The second line starts and all the following lines, recording the currently logged in user, from where to log in, login time, etc.;


load average: refers to the average number of processes running in a queue during a specific time interval.   

The first value represents the average load value of the system within 1 minutes, the second value represents the average load value of the system within 5 minutes, and the third value represents the average load value of the 15-minute system. The meaning of this value is the number of CPU active processes per unit time period. The larger the value, the greater the pressure on your server. In general, this value as long as the number of servers does not have a relationship, if the number of servers CPU is 8, then this value if less than 8, the current server is no pressure, otherwise it will pay attention to.


Cat/proc/cpuinfo View the number of CPUs and the number of cores  

Processor number of threads, starting from 0 (e.g. 8 threads 0-7)

Core ID Number of cores

[[email protected] ~]# cat/proc/cpuinfo |grep-c ' processor ' 1[[email protected] ~]# cat/proc/cpuinfo |grep-c ' core ID ' 1

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6B/83/wKiom1UvYq2iwMsKAAGN55mKEYs149.jpg "title=" QQ picture 20150416140310.png "alt=" Wkiom1uvyq2iwmskaagn55mkeys149.jpg "/>


< Strong style= "Background-color:inherit;" >2, monitoring System process status –top

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/6b/83/wkiom1uvydpromktaadr_lkh4si512.jpg "title=" top.jpg "alt=" wKiom1UvYdPROMKTAAdR_ Lkh4si512.jpg "/>650) this.width=650;" Src= "http://s3.51cto.com/wyfs02/M00/6B/83/ Wkiom1uvybvxnrvraab66cyklmc861.jpg "title=" top-c.jpg "alt=" wkiom1uvybvxnrvraab66cyklmc861.jpg "/>650" this.width=650, "src="/e/u261/themes/default/images/spacer.gif "style=" border:1px solid rgb (221,221,221); background-position:50% 50%; "alt=" Spacer.gif "/>650" this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6B/83 /wkiom1uvymyb4poqaaqk9qqjouw272.jpg "title=" 8cpu.jpg "alt=" Wkiom1uvymyb4poqaaqk9qqjouw272.jpg "/>


Tasks, similar to the Windows process;

Running the process being run;

The process of sleeping dormancy;

Stopped the process of suspending or stopping;

Zombie Zombie process;

RES This is the amount of memory the process occupies;

%MEM is the percentage of memory used.

In the top state, the default is by CPU usage size, and by pressing SHIFT + M, you can sort by memory usage size. Press the number ' 1 ' to list the usage status of each CPU.

TOP-BN1 represents the use of non-dynamic printing system resources, which can be used in shell scripts.
Top-c dynamic Display, the right-most command can display more detailed information.


3, real-time monitoring system Status Vmstat

Vmstat Monitoring Once

Vmstat 1 real-time monitoring, 1 seconds to refresh, press CTRL + C exit;

Vmstat 1 10 monitor only 10 times;

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/6b/83/wkiom1uvyvjginmyaad6ojlz0a8238.jpg "title=" vmstat.jpg "alt=" Wkiom1uvyvjginmyaad6ojlz0a8238.jpg "/>


vmstat the meaning of each indicator:
R : Indicates the number of processes running and waiting for the CPU time slice, if the long-term is greater than the number of server CPUs, the CPU is not enough;
B: Indicates the number of processes waiting for a resource, such as waiting for I/O, memory, and so on, if the value of this column is greater than 1 for a long time, you need to : The amount of memory entered by the swap area;
So: The amount of memory that enters the swap area;
Bi: The amount of data read from the block device (read disk);
Bo: The amount of data written from the block device (write disk);
in:   the number of interrupts per second, Contains the clock interrupt;
CS:   The number of context switches per second;
WA: Indicates the percentage of CPU time consumed by I/O waits.

4. View system memory usage    free

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/6b/83/wkiom1uvyypcu80raaearcvt1v0651.jpg "title=" free.jpg "alt=" Wkiom1uvyypcu80raaearcvt1v0651.jpg "/>


The free default is displayed in K;

Free-m is displayed in m units;

Free-g is displayed in G units;
MEM (total): Number of memory;

MEM (used): already allocated memory;

Mem (free): unallocated memory;

MEM (Buffers): system-assigned but not used buffers;

MEM (cached) system allocated but not used cache;
Buffers/cache (used): The actual use of buffers and cache total, but also the actual use of memory;

Buffers/cache (free): the sum of unused buffers and the cache and unallocated memory, which is the current actual memory available to the system, and (Free+buffers+cached's total is the actual memory currently available)
The buffers (buffer) is about to be written to the disk, and the cache is read from disk;



5. View System process PS
ps aux   or     ps-elf     Detailed display of all process states of the current system /span>
PID: The ID of the process, this ID is useful, the kernel management process in Linux relies on PID to identify and manage a certain process (for example, I want to terminate a course, the ' kill   process PID ' sometimes can not kill, You need to add a-9 option to the kill  -9   process pid)
STAT: Represents the state of the process, the process state is divided into the following types of
D     processes that cannot be interrupted (usually IO)
R     Running processes
S     processes that have been interrupted, most of the processes in the system are in this state
T     have stopped or paused, if we are running a command such as sleep 10 if we press Ctrl-z to let him pause, then we use PS to view will show t this status
X     Already dead process (this never appears)
Z     zombie process, kill, undead garbage process, The system is a small resource, but it doesn't matter. If too many, there is a problem.
<     High-priority process
N     Low-priority process
L     memory-locked memory paging
S     main process
L   & nbsp: Multithreaded Process
+     process in foreground

Pstree tree Show All Processes

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/6b/83/wkiom1uvy3fxd6wuaaf6bi6fmrw145.jpg "title=" pstree.jpg "alt=" Wkiom1uvy3fxd6wuaaf6bi6fmrw145.jpg "/>


6, monitoring network card traffic, historical load SAR

command to install the SAR: Yum install-y sysstat

Sar-n DEV View network card traffic

Sar-n DEV 1 Real-time monitoring network card traffic, 1 seconds to refresh once, press CTRL + C exit;

Sar-n DEV 1 10 View network card traffic, 1 seconds to refresh once, view 10 times;
Sar-n dev-f/var/log/sa/sa16 Check the system log to save the network card traffic information, according to the date of the day named;
View Historical Load Sar-q
View disk read-write Sar-b


7. Check the network status netstat
NETSTAT-LNP View current system-enabled ports and sockets
Netstat-an View all connections to the current system

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6B/7F/wKioL1UvZQSC99RMAAWcaoH7ZgY201.jpg "style=" float: none; "title=" netstat-lnp.jpg "alt=" Wkiol1uvzqsc99rmaawcaoh7zgy201.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6B/7F/wKioL1UvZRizfyXcAAWBkzomft0076.jpg "style=" float: none; "title=" netstat-an.jpg "alt=" Wkiol1uvzrizfyxcaawbkzomft0076.jpg "/>




This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1633403

Commands for daily management of Linux systems

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.