Linux operation and maintenance of common commands summary

1. Delete 0 byte file 
Find -size 0 -type -exec RM -rf F {} \;    
2. Check process 
according to descending order of memory 
PS -e -o "% C:% p:% z:% a "| Sort -k5 -NR    
3. press descending order cpu utilization 
PS -e -o"% C:% P:% Z:% a "| Sort -NR    
4. Print said cache instead of the URL 
grep -a JPG -R & lt / Data / Cache / * | strings | grep "http:" | awk -F'http: '' {Print "http:" $ 2;} '    
5. the view and the number of concurrent TCP connection request to the http status: 
the netstat -n | awk '/ ^ TCP / ++ {S [$ of NF]} for the END {(S in A) Print A, S [A]}'      
6. The Sed -i '/ Root / S / NO / yes / '/ etc / ssh / sshd_config sed in this paper in a row Root, Root match line, will no replace yes.    
7.1 mysql how to kill process:. 
PS the AUX | grep mysql | grep -v grep | awk' {print $ 2} '   | xargs kill -9 (learned from the use of awk) 
killall mysqld -TERM   
kill -9 `cat / usr / local / apache2 / logs / httpd.pid` try killing the process PID   
8. Display run level 3 open service: 
LS /etc/rc3.d/S* | cut -c 15- (learned from the use of cut, and the interception of data)   

The number of CPU (multi-accounting plurality of CPU, cat / proc / cpuinfo | grep -c processor) more, the system load is low, the number of requests per second also able to handle more. 
CPU 16 loads # cat / proc / loadavg 
before checking whether the output value exceeds three times the system logic of the CPU 4. 
15. the statistics about the size because a colleague to all of the following jpg file servers, wrote a shell to him to count turned out to achieve with xargs, but he was part of a deal, out of more than the sum of ...., the following command will be able to solve it. find / -name *.   jpg -exec wc -c {} \;|awk '{print $1}'|awk '{a+=$1}END{print a}'   
  
    
18 CPU load #mpstat 1 1% idle check is too low (such as less than 5%)    
19 # free memory 
to check whether the value is too low may be free with CAT # / proc / meminfo    
20 is the swap space # free 
check value too swap used If the swap used high value is too high, further action is frequently checked swap: # vmstat 1 5 
observation si and so value is larger    
21 disk space # df -h 
to check for partition usage (Use%) is too high (for example, more than 90 %) found a nearly empty space partition, enter the partition's mount point, to find out the most space a file or directory with the following command: # du -cks * | the Sort -rn | head -n 10    
22 disk I / O load check # iostat -x 1 2 I / O usage rate (% util) exceeds 100%    
23 # sar -n DEV network load check network traffic (rxbyt / s, txbyt / s ) is too high    
24 network error # netstat -i 
to check for network errors (drop fifo colls carrier) can also use the command: # cat / proc / net /    dev 
number 25 network connections netstat -an # | grep -E "^ (tcp)" | Cut -c 68- | the Sort | uniq -c | the Sort -n    
26 the total number of processes # ps aux | wc -l inspection process The number is normal (for example more than 250)    
27 can run a process number # vmwtat 1 5 
column gives the number of processes can be run, the system checks whether it exceeds 4 times the logical CPU    
whether the process 28 # top -id 1 was observed abnormalities appear process    
29 network whether the status check DNS, gateway can communicate normally    
30 users # who | wc -l 
to check whether the user login too many (such as more than 50) can also use the command: # uptime   

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11110552.html