Common linux Command combinations

Source: Internet
Author: User

Common linux Command combination serial number Task Command combination 1 Delete 0-byte file find. -type f-size 0-exec rm-rf {}\; find. type f-size 0-delete2 view the process and sort ps-e-o "% C: % p: % z: % a "| sort-k5-nr3 sort ps-e-o" % C: % p: % z: % a "| sort-nr4 print the URL grep-r-a jpg/data/cache/* in the cache | strings | grep" http: "| awk-F' http: ''{print" http: "$2 ;} '5 view the number of http concurrent requests and their TCP connection status netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) prin T a, S [a]} '6 sed in this text the Root row matches the Root row and replaces no with yes. Sed-I '/Root/s/no/yes/'/etc/ssh/sshd_config7 how to kill the mysql process ps aux | grep mysql | grep-v grep | awk '{print $ 2} '| xargs kill-9 killall-TERM mysqldkill-9 'cat/usr/local/apache2/logs/httpd. pid '8 shows the service enabled at level 3 (learn the purpose of cut and intercept data) ls/etc/rc3.d/S * | cut-c 15-9, use EOF cat <EOF + --------------------- + | = Welcome to Tunoff services ==|+ --------------------- + EOF10 for usage (such as creating a soft link to mysql) cd/ Usr/local/mysql/binfor I in * do ln/usr/local/mysql/bin/$ I/usr/bin/$ idone11 get the IP address ifconfig eth0 | grep "inet addr: "| awk '{print $2}' | cut-c 6-ifconfig | grep 'inet addr: '| grep-V' 127. 0.0.1 '| cut-d: -f2 | awk '{print $1} '12 memory size free-m | grep "Mem" | awk' {print $2} '13 check port 80 connections, and sort netstat-an-t | grep ": 80" | grep ESTABLISHED | awk '{printf "% s \ n", $5, $6} '| sort14: view the number of concurrent Apache requests and their TCP connections State netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print, S [a]} '15 count the size of all jpg files under the server. find/-name *. jpg-exec wc-c {}\; | awk '{print $1}' | awk '{a + = $1} END {print a}' 16 CPU count cat/proc/cpuinfo | grep-c processor17 CPU load cat/proc/loadavg18 CPU load mpstat 1 119 memory space free20 disk space df-h21 if a partition is found to be nearly exhausted, you can access the mount point of the partition, run the following command to find the most occupied file or directory du-cks * | sort-rn | head-n 1022 disk I/O load iostat-x 1 223 Network Network load sar-n DEV24 network error netstat-icat/proc/net/dev25 network connection count netstat-an | grep-E "^ (tcp) "| cut-c 68-| sort | uniq-c | Total number of sort-n26 processes ps aux | wc-l27 view process tree ps aufx28 Number of runable processes vmwtat 1 529 check DNS Server is the job normal, take 61.139.2.69 as an example. dig www.baidu.com @ 61.139.2.6930 check the number of currently logged-on users who | wc-l31 log view, search cat/var/log/rflogview/* errorsgrep-I error/var/log /messagesgrep-I fail/var/log/messagestail-f-n 2000 /Var/log/messages32 kernel log dmesg33 time date34 Number of opened handles lsof | wc-l35 network packet capture, directly output summary information to the file. Tcpdump-c 10000-I eth0-n dst port 80>/root/pkts36 then check the number of IP duplicates and sort them in ascending order. Note that "-t \ + 0" contains two spaces., usage of the less command. Less pkts | awk {'printf $3 "\ n" '} | cut-d. -f 1-4 | sort | uniq-c | awk {'printf $1 」 "$2 」 \ n" '} | sort-n-t \ + 037 kudzu view Nic model kudzu-probe-class = network

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.