Home>Article>Operation and Maintenance> Commonly used linux commands
Commonly used Linux commands are: 1. cd command, used to switch directories; 2. ls command, used to display the contents of the specified working directory; 3. pwd command, used to display the location of the working directory; 4. mkdir command, used to create directories; 5. cp command, used to copy files or directories, etc.
I believe that many development and operation and maintenance are using the Linux operating system, because most servers are liunx systems.
The directory structure of Linux is a tree structure. The top-level directory is the root directory /. Other directories can be added to the tree by mounting and removed by unmounting.
Let us learn about the commonly used file directory operation commands:
Related recommendations: "Linux Video Tutorial"
cd
#change directory, switch directory
Relative path: refer to the current directory to search, such as:
cd ../usr/local/src/
Absolute path: from the root Start specifying the directory and search recursively one level at a time. In any directory, you can enter the specified location, such as: cd /etc/
ls
Used to display the contents of the specified working directory (without parameters, the contents of the current directory will be listed.
Syntax:
ls [选项] [文件或目录]
Example:
-rw-r--r--. Indicates that the owner of the file has read and write permissions, and the group and others have only read permissions. (" ."Represents ACL permissions)
pwd
Displays the location of the working directory (displays the absolute path)
mkdir
Create a directory, -p creates recursively, used to create multi-level directories
Syntax:
mkdir -p [目录名]
cp
copy, copy files or directories
Syntax:
cp [选项] [原文件或目录] [目标目录]
mv
move, cut or rename, if the original file and the target directory are in the same directory, it is renamed, otherwise it is cut
Syntax:
mv [原文件或目录] [目标目录]
rm
remove, delete a file or directory
Syntax:
rm -rf [文件或目录]
Options: -r delete directory; -f force
It is best to be careful with this command
rmdir
remove empty directories, delete empty directories (Rarely used)
Syntax:
rmdir [目录]
The above is the detailed content of Commonly used linux commands. For more information, please follow other related articles on the PHP Chinese website!