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