Du-sh * shows the size of some files Df-h is there any remaining disk space?-a All file system list-H easy-to-read display of 1k=1000 instead of 1k=1024 copy source resources to target directory scp-r [email Protected]:/roo t//HOME/ADMINISTRATOR/DESKTOP/NEW/SCP [Email protected]:/root/1.txt/home/administrator/desktop/new/
Ulimit-n View the number of file handles
Ulimit-n 2048 for modification
Locale View system's default encoding
TAR-ZXVF file.tar.gz FILETAR-ZCVF file.tar.gz
Zip-r filename.zip file1 filesdir-r options Recursive directory unzip filename.zip gzip-c abc.tar > Abc.tar.gzgunzip abc.tar.gz grep base This form of grep [option] [pattern] [files] By default, ' grep ' searches only the current directory. There are two ways to resolve this: explicitly require search subdirectories: Grep-r or Ignore subdirectories: grep-d skip-i: Ignoring case
-C: Print the number of matching rows
-L: List only matching file names
-V: Find rows that do not contain matches
-N: Prints the row and row labels that contain matches-W: matches only the entire word, not part of the string (such as matching ' magic ' instead of ' magical ')
The basic form of find find [path]-name [pattern]
Find. -amin-10 #查找在系统中最后10分钟访问的文件
Find. -atime-2 #查找在系统中最后48小时访问的文件
Find. -empty #查找在系统中为空的文件或者文件夹
Find. -group Cat # finds files that belong to Groupcat in the system (tried, the command is incorrect.) )
Find. -mmin-5 # Find files that have been modified in the last 5 minutes of the system
Find. -mtime-1 #查找在系统中最后24 hours of modified files
Find. -nouser #查找在系统中属于作废用户的文件 (I don't know what that means)
Find. -amin #查找在系统中最后10分钟访问的文件
Find. -user Root #查找在系统中属于root这个用户的文件
Find/tmp-size +10000000c-and-mtime +2 #查找 a file larger than 10000000 bytes in the/tmp directory and modified within 48 hours
Find/tmp-user Tom-or-user George #查找 files belonging to the two users of Tom or George in the/tmp directory
Find/tmp! -USR Fred #查找 The files that are not part of Fred in the/tmp directory
The awk basic form awk '/pattern/{action} ' {filenames} pattern is an optional awk workflow that reads a record with a ' \ n ' line break, then divides the record by the specified domain delimiter, fills the field, and $ A will represent all domains , $ $ represents the first field, $n represents the nth field. The default domain separator is the blank key or the [tab] key.built-in variables (including $0-n)
ARGC command-line arguments argv command-line parameter arrangement environ support the use of system environment variables in queues filename awk browses the file name Fnr the number of records to browse files FS Set input field delimiter, equivalent to command line-F option NF Browse record number of fields nr Read records ofs output field delimiter ors Output record delimiter Rs control record delimiter |
Example:Awk-f ': '/^root/{print $ '/etc/passwd awk-f ': ' {print ' \ t ' $7} '/etc/passwd awk-f ': ' {print ' filename: ' F Ilename ", linenumber:" NR ", Columns:" NF ", Linecontent:" $ A} '/etc/passwdawk-f ': ' {printf ("filename:%10s,linenumber:% S,columns:%s,linecontent:%s\n ", filename,nr,nf,$0)} '/etc/passwdawk ' BEGIN {count=0;print" [Start]user Count is], Count} {Count=count+1;print $;} End{print "[End]user Count is", count} '/etc/passwd
commands to troubleshoot problems on the serverW,last who is online, which users have visited history commands executed on the server (export histtimeformat= '%F%T ') (add extended_history= On to/etc/environment) Pstree -a,ps aux View existing processes Netstat -ntlp,netstat -nulp, NETSTAT -NXLP Find all running services, each listening port. The PID in the list of services displayed in Netstat is the same as in the list of PS aux processes. Free -m,uptime,top,htop  CPU and memory Lspci,dmidecode,ethtool Find a RAID card (with a BBU backup battery), CPU, A spare memory slot. Is the NIC set? Are you running in half duplex state? Is the speed 10MBps? Do you have tx/rx error iostat -kx 2 Check disk usage vmstat 2 10 switch swap mode on mpstat 2 10  CPU by WHO occupancy: system process? User process? Virtual machine? Dstat --top-io --top-bio who is in the go, line io is not MySQL ate all the system resources? Or is it your PHP process? Mount How many file systems are mounted Cat /etc/fstab is there a service-specific file system? (like MySQL?) What are the mount options for the VGS file system: Noatime? Default? pvs Is there a file system that is re-mounted as read-only mode? lsof +d //* beware not to kill your box */ If there is a problem with disk space, do you still have room to expand a partition? Dmesg,less/var/log/messages,less/var/log/secure,less/var/log/auth syslog and kernel messages ls /etc/cron* + cat,for user in $ (cat /etc/passwd | cut -f1 -d:); do crontab -l -u $user; done Is there a scheduled task that runs too often, and whether some users submit hidden scheduled Tasks
Top top command to get the most CPU-consuming process
PS P 10495-l-o pcpu,pid,tid,time,tname,cmd > ~/10495ps.txt Find those threads in this process that are consuming high CPU
Linux Common commands