-
Create a directory: mkdir directory name
exp: mkdir test Create a directory named test
to delete directory: rmdir directory name
exp: rmdir test delete empty directories named test
rmdir -r directory name
exp: rmdir -r test (-r delete All content directory) -
Change directory: cd catalog
cd / to switch to the root directory
cd ... / switch to the parent directory (cd ...)
cd ~ to switch to the home directory
cd - Change to the directory last visited
NOTE: The path problems
absolute path: The path name is from / began. exp: / lib / etc
relative path: the path relative to the current terms, from the beginning of the path name is not /. exp: cd char equivalent to cd ./char -
Catalog: LS
LS view the current directory and all files in a directory
ls -a view the current directory and all files in the directory (including hidden files)
LS the -l filename / directory ranked specify the details of the file or directory include
Note: we often use ls file name / directory name used to verify that the specified file or directory exists -
mv command:
mv file directory 1 1 1 will move the file to a directory 1Contents Contents 1 2 mv 2 under the directory to the directory 1 (provided: the presence of the directory 2)
Note: If a directory exists under the directory 2, and a not empty directory will move failed.
2 If the directory does not exist, the function of this command is: will rename the directory directory 1 2 -
Copy the file / directory:
CP directory file 1 1 1 Copy the file to a directoryAnother function of cp: a file backup to
create cp file file 1 2 1 File a copy of the document 2
Note: The file name is usually 2 can be written like this: file 1_bakcp Contents Contents 1 1 2 -R & lt backup directory (if the directory is absent). If the directory is present then the directory 2 1 2 copy directly to the directory
-
pwd command: Displays the name of the path of the current
-
touch command: create an empty file
touch file name
NOTE: Create an empty file, the path where the need is to have write permission -
rm command: delete the specified file
rm filename
rm directory name -r
rm * -rf function is to delete all the files in the current directory, use with caution! ! ! -
cat command: View the contents of a file
cat file name -
uname command:
uname -r Displays the current use of the operating system version number
uname -m show architecture processor machine -
The date command: displays the current time
-
sudo command: execute superuser privileges
sudo su user to switch to the superuser
Note: Once the super user, you can freely operate all of the files on your system up.
In the terminal type exit to exit superuser
if not in Supervisor mode, you need to execute superuser privileges, using sudo.
exp: you need to create a directory in the test / directory
sudo mkdir test
Linux commands and functions
Guess you like
Origin blog.csdn.net/qq_42483691/article/details/104356344
Ranking