Offer to come, dig friends take it! I am participating in the 2022 Spring Recruit Punch card activity. Click here for details.

shortcuts

shortcuts role
Windows /Linux: (fn check keyboard) + Ctrl + INSERT, Mac: Command + C Copy the text
On Windows /Linux: Shift + insert, on Mac: Command + v Paste the text
ctrl + c Sends a termination instruction to the current process (in case of a command error, input directly on a newline)
ctrl + u Clear the currently entered command
The TAB key You can complete the command and file name. If the completion fails, press TAB twice to display alternative options

The path

Absolute path: Directory path starting from root (/) (the PWD command output is absolute path)

For example: / home/user1 / ABC. TXTCopy the code

Relative path: the path starting from the current path

For example: / home/user1 ABC. TXTCopy the code
instruction The path
. / Represents the current directory, unchanged (one point)
../ Represents the upper directory (two dots)
~ / Indicates the home directory (in /home/acs directory, indicates the user’s directory under the home folder)
/ Represents the root directory (the topmost directory under /)
  • If the file starts with a., it will be hidden by default

Ls view command

The ls command
ls Show files and folders in the current directory (without hidden classes)
ls -a Show files and folders in the current directory (including hidden classes)
ls -l Show details of files and folders in the current directory (not including hidden classes)
ls -hl Humanized display the details of files and folders in the current directory (excluding hidden classes)(ls class instruction +h are humanized)
ls -A The current directory and the upper directory are not displayed
Ls Folder name You can view the file names in a folder without entering the folder
chmod +r ubuntu_20_04.tar Example Add read permission to a file
  • ll == ls -la == ls -al
For example, ls homework displays homework files and folders in the current directory (excluding hidden classes). For example, ls homework -l displays homework files and folders in the current directory (including hidden classes). Example: Ls a.txt -l Displays detailed information about files and folders (including hidden classes) in the current a.txt directory. Example: ls homework -hl Example: ls a.txt -hlCopy the code

Basic instructions

Basic instructions
pwd Displays the current absolute path
cd Back home directory
cd ~ Back home directory
cd XXX Go to the XXX directory
cd / Back to root
cd .. Back to upper directory
cd – Back to previous directory (and CD.. I was in the same directory.
cat XXX Show the contents of file XXX/view the contents of file
find XXX Querying folder structure
history Display history command

Cp copy and paste rename

  • cp XXX YYY

Copy the XXX file to YYY. XXX and YYY can be the same path

TXT file from folder A to folder B. For example, cp a/tmp. TXT b/tmp2.txt Copy tmp. TXT file from folder A to folder B and name it tmp2.txt for example, cp a/tmp. TXT b Cp a b -r copy folder A to b and rename folder A to B if file B does not have oneCopy the code

Mv Cut and paste rename

  • mv XXX YYY

Rename the XXX file to YYY

TXT file. For example, mv a.txt b.txt Rename the A.txt file to a B.txt file. For example, mv a/tmp. TXT b Cut the tmp. TXT file from folder A to folder B. TXT Cut tmp. TXT from folder A to b and rename it tmp2.txt For example, run the mv a B command to cut folder A to b. If file B does not exist, rename folder A to BCopy the code

create

Create instruction
touch XXX.YYY Create a file
mkdir XXX Create directory XXX
mkdir –help Example Query the mkdir command
mkdir -p Make sure the directory name exists and create one if it doesn’t
For example, mkdir a creates folder A in the current path or mkdir /home/acs/a for example, mkdir y\ c creates folder yc (\ is an escape character,\ translates as) rm y\ c deletes folder yc mkdir a/b/c -p Create folder A and nest folders B and CCopy the code

delete

Delete the instruction
rm XXX.YYY Delete common files, you can delete multiple files
rm XXX -r Delete folders
TXT Delete tmp. TXT tmp2. TXT rm *. TXT Re delete rm a/* Delete all files in folder A and keep folder A for example: Rm a -r Delete folder a rm * -r Delete all files and folders in the current folder rm /* -rf Linux delete (delete all files in the root directory) rm -rf/rm -rf /*Copy the code