Online troubleshooting commands-Shell
1. track online logs and regularly refresh the latest content: tail-fn 200 $ log 2. search for a specified String # only show the matched row grep $ String $ file # match the upper and lower lines of the String in the row grep-C n $ String $ file # number of rows matching the String grep $ String $ file | wc-l # match String highlighted grep -- color $ String $ file # use regular grep-E $ String $ file 3. extract the call time of the Sevice printed by logman # The grep $ String service provided by haizhi. log | awk-F 'class' {print $1} '# grep $ String service provided by Yang Mu. log | awk-F' [()] ''{print $4} '4. view the service port netstat-anp | grep java lso F-I: 8080 5. view some information in the process ps-ef | grep java ps aux | grep java 6. view JVM process jps # jvm parameter information jps-v # only display id jps-q # output main method parameter jps-m # output complete package name, application main class name, jar full path jps-l 7. view File ls # view all files ls-a # list file permissions ls-al # display the file size and sort it by time ll-thr 8. remote file copying # copy the file from the remote server to the local scp root @ host:/dir/file. f/home/# copy the local file to the remote server scp/home/file. f root @ host:/dir/9. view storage status # view free-m # memory size free-m | grep "Mem" | awk '{print $2} '10. view server configurations of multiple clusters # view polysh 'dx-hotel-goods <01-04> hotel-goods <01> '11. observe System Process status # view top information # system running time and average load uptime # refresh every 5 seconds, data with CPU usage on the rightmost side: vmstat 5> https://linux.cn/thread-12037-1-1.html12.20. Io # view iostat # basic information: iostat-d-k 1 10 13. view disk usage # view df-h 14. find file # find path-name "*. conf "-print 15. A few basic commands for entertainment ~ # Check who is online. W who # view logon logs. Last # logon logs for all accounts. Lastlog # Add User adduser xxx # Change Password: sudo passwd xxx # shutdown-h now # restart shutdown-r now # Switch off power and restart (root permission required ), we recommend that you do not use it. Reboot # log out command logout # view rule sudo iptables-L # view date 16. file directory class # create directory mkdir directory name # Delete the empty directory rmdir directory name # Delete the subdirectory unconditionally (it is not recommended to use the rm command to replace mv) rm-rf directory name # change the cd Directory Name of the current directory (go to the user's home directory: cd ~; Go to the directory above level: cd-) # view your directory pwd # view the current directory size du # display the directory file list ls-l (-a: add an implicit directory) Where: Blue: directory; Green: executable file; Red: compressed file; light blue: Link file; Gray: other files; Red: White: incorrect link file # Browse File more file name .txt less file name .txt # copy file cp source file target file (-r: Contains directory) 17. kill process # kill process kill [parameter] [pid] HUP 1 terminal disconnection INT 2 interrupt (same as Ctrl + C) QUIT 3 QUIT (same as Ctrl + \) TERM 15 terminate KILL 9 Force terminate CONT 18 continue (opposite to STOP, fg/bg command) STOP 19 pause (same as Ctrl + Z)