1. display the top 10 processes that consume the most memory/cpu ps aux | sort-NK + 4 | tailps aux | sort-NK + 3 | tail ---------------------------------------- 2. view the number of concurrent Apache requests and their TCP connection status netstat-N | awk '/^ TCP/{++ s [$ NF]} end {for (a in S) print, s [a]} '------------------------------------------ 3. find the 10 most commonly used commands and the number of times (or the maximum number of IP addresses accessed) Sed-E's/| // n/G '~ /. Bash_history | cut-D ''-F 1 | sort | uniq-c | sort-Nr | HEAD -------------------------------------------- 4. the 10th fields in the log indicate the connection time. Obtain the average connection time cat access_log | grep "Connect white" | awk 'in in {sum = 0; Count = 0 ;} {sum + = $10; count ++;} end {printf ("sum = % d, Count = % d, AVG = % F/N", sum, count, sum/count)} '-------------------------------------------- 5. lsof command lsof abc.txt shows the process of opening the file abc.txt lsof-I: 22 know what port 22 is running now Program Lsof-c abc displays the file currently opened by the ABC process, lsof-p 12. Check which files are opened by the process with process number 12 ------------------------------------ 6. kill all processes of a program pkill-9 httpdkillall-9 httpd do not use-9 as much as possible, and kill cannot be used easily on the database server. Otherwise, the consequences of causing important data loss will be unimaginable. ------------------------------------------ 7. rsync command (only the compressed files of one day must be synchronized, and the remote directory must be consistent with the local directory)/usr/bin/rsync-azvr-password-file =/etc/rsync. secrets 'Find. -Name "* required yesterday.gz"-type F' storage@192.168.2.23: logbackup/13.21/---------------------------------------------- 8. directory *. the sh file is renamed *. shfind. -name "*. SH "| SED's //(. */)/. SH/MV/0/1.sh/ '| shfind. -name "*. SH "| SED's //(. */)/. SH/mv &/1.sh/ '| SH (same effect as above )- ----------------------------------------- 9. SSH executes a remote program and displays "ls-Al/home/zouyunhao" ------------------------------------------------------------------------------ 10 "locally. directly use the command line to change the password echo "zouyunhaopassword" | passwd-stdin zouyunhao ------------------------------------ ssh-keygenssh-copy-ID-I ~ /. SSH/id_rsa.pub user @ remoteserver ------------------------------------------ 12. share the file in the current folder in http mode $ Python-M simplehttpserver access http: // ip: 8000/in the browser to download the file in the current directory. ---------------------------------------- 13. shell section Note: <'echo Hello, world! '------------------------------------------ 14. view the server serial number dmidecode | grep "serial number" (This command can also be used to view other hardware information on the machine) ---------------------------------- 15. check whether the network adapter has a physical connection/sbin/miI-tool ---------------------------------------- 16. view the meaning of the Linux or MySQL error codes, for example, perror 13------------------------------------------------------17. about the number of CPUs
View the number of logical CPUs: CAT/proc/cpuinfo | grep "processor" | WC-l
Check the number of physical CPUs: CAT/proc/cpuinfo | grep "Physical ID" | sort | uniq | WC-l
View the number of cores of each physical CPU. cores: CAT/proc/cpuinfo | grep "CPU cores" | WC-l
If the number of cores of all physical CPUs is less than the number of logical CPUs, the CPU uses hyper-Threading Technology. Check the number of logical CPUs in each physical CPU: CAT/proc/cpuinfo | grep "Siblings" ---------------------------------------- (updating ......) This article is from Lone wind | website O & M URL: http://yunhaozou.org/perl-shell/162.html.download please keep it.