Classic summary Linux administrator commonly used command combination recommendation, must be added to the favorites oh ..

Source: Internet
Author: User
Classic summary Lnux commonly used commands recommended by administrators, must be added to favorites ..

1. Delete 0-byte files

Find-Type f-size 0-ExEcRm-Rf {};

2. View Processes

Sort by memory from large to small

Ps-e-o "% C: % p: % z: % a" |Sort-K5-nr

3. PressCpU utilization is arranged in ascending order

Ps-e-o "% C: % p: % z: % a" | sort-nr

4. Print the URL in the cache

Grep-R-a jpg/data/cache/* | sTrIngs | grep "http:" | awk-F \ 'HTTP: \ '{print "http:" $2 ;}\'

5. view the number of concurrent http requests and their TCP connection status:

NetStat-N | awk \ '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]} \'

6. sEd-I \ '/Root/s/no/yes/\'/etc/ssh/sshd_configSedIn this document, the Root line matches the Root line and replaces no with yes.

. How to kill the mysql process:

Ps aux | grep mysql | grep-v grep | awk \ '{print $2} \' | xargsKill-9 (learn about the usage of awk)

Pgrep mysql | xargs kill-9 [user: & FROST]

Killall-TERM mysqld

Kill-9'Cat/Usr/local/apache2/logs/Httpd. PId'Try the killing process PID.

8. Run the following three services:

Ls/Etc/rc3.d/S * |Cut-C 15-(learn the purpose of cut and intercept data)

9. How to display multiple pieces of information in a SHELL, using EOF

The number of concurrent requests and TCP connection status of cat Apache:

Netstat-N | awk \ '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]} \'

15. my colleague wants to count the size of all jpg files under the server and write a shell to count them. it was originally implemented using xargs, but when processing part of it at a time, there are multiple sums ...., the followingCommandIt can be solved.

Find/-name *. jpg-execWc-C {}; | awk \ '{print $1} \' | awk \ '{a + = $1} END {print }\'

The more CPUs (multi-core CPUs, cat/proc/cpuinfo | grep-c processor), the lower the system load, the more requests that can be processed per second.

16 CPU load # cat/proc/loadavg

Check whether the first three output values exceed 4 times the system logic CPU.

18 CPU load # mpstat 1 1

Related Article

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.