Basic commands

  • ll
  • ls
  • CD dirName Switches the current working directory
  • CD – Returns the last working directory
  • Mkdir [-p] dirName Create the dirName directory. -p is used to ensure that the directory name exists
  • Rm to delete
  • Rm -r Deletes a folder
  • Rm -r * Delete all files and directories in the current directory
  • Rm -rf Deletes all files and directories in the current directory without confirmation
  • PWD Displays the full path of the current working directory
  • Sudo su super user do sudo su means to run the su command with root permission
  • Su su === shift user Command to switch to another user

The log view

  • Tail -n 10 xxx.log Queries the last 10 lines of a log
  • Tail -f xxx.log Dynamic observation logs
  • Less XXX. The log | grep ‘terrain’ screening keywords log
  • Cat – n XXX. The log | grep ‘landscape’ find key log line number
  • The cat – n XXX. The log | tail – n + 2018 | head – n 20 to find journal 10 lines before and after the 2018 lines

Copying files

  • scp [-option] file_source file_target
    • Copy everything in the local Templates folder to the /home/root/test directory on the remote server
    scp -r /Users/test/work/web/src/main/resources/templates root@10.1010.10.:/home/root/test
    Copy the code
    • In Windows, you can run the rz/sz command to transfer files
  • Cp -r test newtest The newtest directory does not exist
  • Cp -r test/. Newtest Copies the contents of the directory to the newtest directory

other

The netstat command is used to display statistics related to IP, TCP, UDP, and ICMP protocols, and is generally used to check the network connection status of each port on the local host. Netstat is a kernel access application that provides reports on TCP connections, TCP and UDP listening, and process memory management

  • Netstat antp | grep check 5602 port 5602 process
  • Kill -9 PID Sends the SIGKILL signal to forcibly kill a process. The signal cannot be captured or ignored
  • Kill PID Sends the SIGTERM signal to tell the process that it needs to be shut down. The process stops and exits