Switch directory: CDCD directory CD directory/directory CD: : Previous directory CD/: root directory cd ~: Home
Creating directories and deleting directoriesmkdir Create mkdir directory name mkdir-p a/b/c rmdir Delete rmdir directory name: Only one empty directory can be deleted
List of files in the presentation directory (ll can be used later)LS ls: Shows the name of the visible file (and directory) Ls-a: The name file showing all the files is preceded by "." Represents a hidden file ls-l: Shows the details of a file in shorthand way: LL (★) Ll-h: Friendly display
Browse files CAT: Show all contents of the file Cat file name &nbs P MORE: Pagination display space: Next &N Bsp ENTER: Next line Less: pagination display &N Bsp can flip through PgUp PgDn TAIL (★) &NBSP ; See what's behind a file Tail-shows the last few lines of file name &NBS P tail-f file name Dynamic View & nbsp For example: tail-f catalina.xxx.log End scrolling through CTRL + C
file Create a file Touch filename &N Bsp Create a blank file Copy file &NBS P CP file directory/file name For example: &N Bsp CP 1.txt 2.txt &NB Sp CP 1.txt 1/1.txt Move file (rename) MV file directory/file name MV filename new file name & nbsp Delete files rm RM file name: With ask to delete &NBSP ; rm-f file name: Delete without inquiry RM-R directory: Recursive delete with query &NBSP RM-RF directory: recursive deletion without asking (use cautiously) TAR: Packaged or Unzip a file or directory (★) The common combination &NBS P -CVF: Package a file or directory -ZCVF: Package and compress a file or directory compression format:gzip -XVF: Unzip or open a tar file &NBSP ; format: tar parameter file name to package Unzip files directory For example: Package All files in current directory into test1.tar & nbsp TAR-CVF Test1.tar ./* to package and compress all files in the current directory into test2.tar.gz& nbsp &nbsP TAR-ZCVF test2.tar.gz ./* &NBSP ; Test1.tar unzip to current directory TAR-XVF test1.tar Test1.tar extract to B catalogue TAR-XVF test1.tar-c b
grep: Finding strings that match the criteria (★)grep string pwd: Displays the current working directory wget: Download data wget resource Path
VI and VIM Editor (understanding)Edit Normal file Three modes: command line, insert, bottom row mode. Switch to command line mode: Press ESC, switch to insert mode: Press I, O, a key, I insert at current position I insert a at the beginning of the current position after inserting a at the current line end insert O in the current line Insert a row after and insert a row before the current line exit edit esc:q! Save ESC:WQ Switch to the bottom line mode: press: (colon);
Pipe |★An important concept whose function is to use the output of one command as input for another command such as: Find 192.168 strings in ifconfig results Ifconfig | grep 192.168 after common find and Java-related processes Ps-ef | grep Java Find and 3306 related information Ps-ef | grep 3306
System Administration CommandsDate display or set system time date displays current system time Date-s "2014-01-01 10:10:10" set system time clear clear screen ctrl+l PS is running a Status of a process ps–ef view all Processes ★ps–ef | grep ssh finds a process kill kills a process kill 2868 kill 2868 numbered process ★kill-9 2868 Force kill process
Network ManagementIfconfig: View all network settings ifconfig NIC name down: Disable NIC ifconfig nic name up: Enable network card ping: Cancel with Ctrl + C as in window Netstat view the network ports. Netstat-an | grep 3306 Query 3306 port occupancyRestart
command:1, reboot 2, Shutdown-r now restart (root user) 3, shutdown-r 10 10-minute automatic restart (root user) 4, shutdown-r 20:35 restart at 20:35 time (root user Use) If you set the restart through the shutdown command, you can use the Shutdown-c command to cancel the restart Shutdown command: 1, halt immediately shutdown 2, Poweroff immediately shut down the Machine 3, Shutdown-h now immediately shutdown (root user ) 4, shutdown-h 10 10 minutes after auto power off
Network configuration:1, vi ifcfg-eth0 2, DEVICE = eth0 Onboot = yes nm_controlled = yes Bootproto = static ipaddr = 192.168.153.124 NETMASK = 255.255.255.128 Gatrway = 192.168.153.126 DNS1 = 114.114.1 14.114 3, service network restart Systemctl Restart Network.service
Linux Common Command Collection