Linux basics-2day-Linux document operation command-(cd/pwd/mkdir/rm/mv)

Linu the X- document operation command - ( cd / pwd / mkdir / RM / mv )

1. The cd command

Description: Switch the current directory to another directory.

Usage: cd directory path 

symbol

significance

.

Current directory

..

Parent directory

~

Current user home directory

-

Previous working directory

Eg1 :

[

root@test ~]#cd /etc/ #Switch to the /etc directory

2. pwd command

Description: Display the name of the current working directory

Usage: pwd [parameter option]

Parameters: -P displays the real path of the link

Eg1 :

[root@test ~]# pwd #View the current directory name 
/root

3. The mkdir command

Description: Create a directory

Usage: mkdir [parameter option] [directory name]

parameter:

parameter

Features

-m

--mode=mode, set permissions <mode> (similar to chmod)

-p

Recursively create multi-level directories

-v

 --verbose display information every time a new directory is created

–help

Show this help message

–version

Display version information

Eg1:

[root@test tmp]# mkdir -m 777 mysql #Create mysql directory and set 777 permissions  
[root@test tmp]# mkdir -p /tmp/1/2/3/4 #Create directory recursively

4. rm command

Description: Delete files or directories

Usage: rm [parameter option] [file/directory]

parameter:

-r

Recursively delete, delete the directory and all contents under the directory

-f

Forced to delete without prompt

-i

Before deleting, ask whether to delete

Eg1:

[root@test ~]# rm -rf test #Forcibly delete the test directory

5. mv command

Description: Move or rename files or directories

Usage: mv [parameter options] [directory/file name] [directory/file name after moving]

parameter:

-b

If you overwrite the file, back it up before overwriting

-f

The file already exists, just overwrite without asking

-i

The target file already exists, ask whether to overwrite

-u

Update file (the target file exists)

Eg:

[root@test ~]# mv 1.txt 1.log #Rename 1.txt to 1.log 
[root@test ~]# mv 1.log test #Move 1.log to the test directory

Personal public number:

Picture.png

 

 

 


Guess you like

Origin blog.51cto.com/13440764/2576710