Shell
List the 10 most frequently used shells
History | awk '{A [$2] ++} end {for (I in a) {print a [I] "" I}' | sort-Rn | HEAD
History | awk '{A [$4] ++} end {for (I in a) {print a [$ I] & quot; i} '| sort-Rn | HEAD
Grep-V "#". bash_history | awk '{++ A [$1]} end {for (I in a) print I, a [I] | "sort-K2-Nr"}' | HEAD
Number of Network Connections
Netstat-an | grep-e "^ (TCP)" | cut-C 68-| sort | uniq-c | sort-N # check the number of connections in the status
Netstat-NTU | awk '{print $5 "\ n"}' | cut-D: -F1 | sort | uniq-c | sort-Nr | head-N 20 # Count IP connection count
Netstat-an-T | grep ": 22" | grep established | awk '{printf "% S % s \ n", $5, $6} '| sort | WC-L # Number of process connections
Nic IP Address
/Sbin/ifconfig | SED's /. * Inet ADDR :\(. * \) BCA. */\ 1/G' | sed-n'/BR/{n; p} '# bind the dual Nic
/Sbin/ifconfig | SED's /. * Inet ADDR :\(. * \) BCA. */\ 1/G' | sed-n'/ETH/{n; p} '# use this
Ifconfig eth0 | grep "Inet ADDR:" | awk '{print $2}' | cut-C 6-or
Ifconfig | grep 'inet ADDR: '| grep-V' 127. 0.0.1' | cut-D:-F2 | awk '{print $1 }'
System Information Statistics
Dmidecode-T system | grep-e 'serial' | awk-F': ''{print $2} '(system serial number query)
CAT/proc/cpuinfo | grep CPU | awk-F: '{print $2}' | sort | uniq-C (number of CPU cores)
Dmidecode-T system | grep 'product' | awk '{print $3 $4}' (Single Board device type)
Dmidecode | grep-p-A 5 'memory devic' | grep size | grep-v range | grep-I-v "No module" | sed-r's/^ \ s + // G' | sort | uniq-C (memory size)
Echo '/sbin/ifconfig | SED's /. * Inet ADDR :\(. * \) BCA. */\ 1/G' | sed-n'/ETH/{N; p} '''hostname'>/etc/hosts: Use the IP address and host name to direct to/etc/hostname.
System packet capture Analysis
Tcpdump-C 10000-I eth0-N DST port 80>/root/Pkts (tcpdump captures packets to prevent port 80 from being attacked and analyze data)
Less | awk '{printf $3 "\ n"}' | cut-D. -F 1-4 | sort | uniq-c | awk '{printf $1 "" $2 "\ n"}' | sort-n-t \ + 0 (then check number of IP duplicates in ascending order. Note that there are two spaces in the middle of "-T \ + 0)
System Process Management
PS-eo pid, lstart, etime | grep 26871 (process running time)
Lsof-P 10412 (view the file opened by the process. 10412 is the PID of the process)
PS-e-o "% C: % P: % Z: % A" | sort-K5-NR (view the process in a descending order of memory)
PS-e-o "% C: % P: % Z: % A" | sort-NR (in ascending order of CPU utilization)
PS aux | grep MySQL | grep-V grep | awk '{print $2}' | xargs kill-9 (kill the MySQL process)
Killall-term mysqld:
PS-eal | awk '{if ($2 = "Z") {print $4}' | kill-9 kill dead processes
Nic traffic
Dstat-acdgilmnprsttfy (centos view Nic traffic)
Iftop (SUSE system Nic traffic)
Sar-N Dev 1 10 (SUSE system Nic traffic)
Iotop-O (view the process's most disk-grinding)
File Management
Delete 0-byte files
Find-type F-size 0-exec Rm-RF {}\;
View 10 large files in the directory
Du-CKS * | sort-Rn | head-N 10
Du-h -- Max-depth = 1/home
Merge two columns into one row in three ways
CAT test
192.168.110.171
00: 1f: D0: D4: DD: 47
Xargs-N 2 <Test
Sed 'n'; S/\ N // 'test
Awk-V ors = "" '{printf $0 ""} Nr % 2 = 0 {print "\ n"} '1 Test
192.168.110.171 00: 1f: D0: D4: DD: 47
This article from the "Lu Bu world" blog, please be sure to keep this source http://2364821.blog.51cto.com/2354821/1434094