This article introduces some common basic instructions in Linux for your study and reference.
Table of contents
touch command and mkdir command
ls command
Common usage:ls -l: list the detailed information of the filels -a: s lists all files in the directory, including hidden files beginning with .
pwd command
Function : Display the current directory of the user.
cd command
Common usage:
cd ~ : enter the user's home directory.cd - : Returns the most recently accessed directory.cd root/cx/a.txt : Absolute path access.
.and..
In the Linux command, . represents the current directory .. represents the parent directory
Common usage:
cd .. Return to the parent directory
cd ../day02/ : relative path access./test.out : Execute the executable program
touch command and mkdir command
Common usage:touch test.txt : Create a document in the current directory .
Common usage:mkdir newname : Create a new directory under the current directory.mkdir -p test/test1/test2/test3 : Create multiple directories recursively.
Note: Documents and directories are different. In a directory tree, documents or empty directories must be the leaf nodes of the tree, while non-empty directories are the branch nodes of the tree.
rm command
The above touch and mkdir commands are the creation of files and directories, followed by the deletion of files and directories.
Common usage:rm file name : delete file (leaf node)rm -f filename : force delete file (do not ask)rm -r directory name : recursively delete the directory and all files under it.rm -f -r directory name : recursively delete the directory and all files under it (do not ask)
man command
Common usage:man [command] : Enter the manual, press 'q' to exit, and use the up and down keys on the keyboard to view the document.
The next article introduces file viewing, modification, etc. to file content instructions.