Common directory and path related commands in linux

  • 2020-05-30 21:56:09
  • OfStack

Common directory and path commands in linux

Relative path and absolute path

Absolute path: path learning method 1 must start from the root directory/write. Such as/user share/doc.

Relative path: the directory does not start/write. If you want to switch from /user/share/doc to /user/share/man, you can write "cd.. /man "is the right way to write it.

Directory related operations

.represents this layer directory

. Represents the upper level directory

- represents the previous working directory
~ represents the home folder of the current user

~user1 represents the user's home folder, user1

Common process directory commands:

cd: switch directories

pwd: displays the current directory

mkdir: create a new directory

rmdir: delete an empty directory

pwd - p 】 【

-P shows the current path instead of using the connection path

mkdir [-mp] directory

-m: permissions for configuration files. Set it directly.

-p: helps you create the directory you need recursively.

rmdir [-p] directory

-p: delete 1 with the upper "empty" directory.

Variable about the path of the executable: $PATH

Execute "echo$PATH" to see which directories are defined

root user under execution


 [root@iZwz99w26fq15zuqbxgeltZ ~]# echo$PATH

-bash: echo/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin: No such file or directory

Execute under normal user


[user1@iZwz99w26fq15zuqbxgeltZ ~]$ echo$PATH
-bash:echo/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user1/.local/bin:/home/user1/bin: No such file or directory

The contents of the PATH variable are separated by a heap of directories separated by (:), and the directory /bin is available to any user anywhere under the command /bin/ls.

The Linux directory and the path of the common command content sorted out above hope to help you!


Related articles: