Linux study notes (6) -- File management (Part 1)

This article takes CentOS7this as an example.

Directory structure of this article

Linux file management instructions (Part 1).png

pwd command

1 purpose

Displays the absolute path of the current directory.

2 Basic grammar
pwd 

ls command

1 purpose

View the contents of the current file directory.

2 Basic grammar
2.1 Basic format
ls [选项] [目录或文件路径]
2.2 Common options
  • -aIndicates that all files and directories in the directory are displayed (including hidden ones. Hidden files in Linux begin with ..)
ls -a  [目录或文件路径]
  • -lIndicates displaying file directory information in list form
ls -l  [目录或文件路径]

cd command

1 purpose

Switch to the specified directory file.

2 Basic grammar
2.1 Basic format
cd [目录或文件路径]
2.2 Switch to the current user’s home directory
cd  ~
2.3 Return to the previous level of the current directory
cd ..

mkdir command

1 purpose

Create a directory.

2 Basic grammar
2.1 Basic format
mkdir [选项] [要创建的目录]
2.2 Common options
  • No options, only first-level directories can be created
mkdir [要创建的目录]
  • -pIndicates creating a multi-level directory
mkdir -p [要创建的目录]

rmdir command

1 purpose

Delete the directory.

2 Basic grammar
2.1 Basic format
rmdir [选项] [要创建的目录]
2.2 Common options
  • No options, empty directories are also deleted by default.
rmdir [要创建的目录]
  • -rf, delete only non-empty directories
rmdir -rf [要创建的目录]

touch command

1 purpose

Create an empty file.

2 Basic grammar
touch [文件名]

Guess you like

Origin blog.csdn.net/qq_22255311/article/details/126165951