Home>Article>Operation and Maintenance> Commonly used linux commands

Commonly used linux commands

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-06-11 10:40:06 675995browse

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.

Commonly used linux commands

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.

Commonly used linux commands

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/

Commonly used linux commands

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:

Commonly used linux commands

Commonly used linux commands

-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)

Commonly used linux commands

mkdir

Create a directory, -p creates recursively, used to create multi-level directories

Syntax:

mkdir -p [目录名]

Commonly used linux commands

cp

copy, copy files or directories

Syntax:

cp [选项] [原文件或目录] [目标目录]

Commonly used linux commands

Commonly used linux commands

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 [原文件或目录] [目标目录]

Commonly used linux commands

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:linux learning route Next article:linux learning route