Linux command learning series 9-directory related operations cd, mkdir, rmdir, cp

Review the content of the previous section:

1. Create a file: touch command

2. Delete files: rm command

3. Move files: mv command

4. View files: cat, head, tail commands

Homework: Create a file test.txt in the root directory, create a directory test (command is mkdir), move test.txt to the test directory, and rename it to test.doc

touch test.txt

mkdir test

mv test.txt /test

mv /test/test.txt /test/test.doc

Contents of this section:

Directory related operations

1. Enter the directory: cd command

Common commands, usage, cd directory

clip_image001

2. Create a directory: mkdir command

Common commands, usage: mkdir directory

3. Delete directories: rmdir and rm

The rm command has been mentioned in the previous section. The effect of rmdir is the same as that of rm –df, that is, only empty directories can be deleted. To delete non-empty directories, please use rm -dfr

4. File and directory copy: cp

The cp command is very similar to the mv command, copying a file to a directory:

clip_image002

To copy a directory to another directory, you need to add the -r parameter:

clip_image003

clip_image004

clip_image005

Homework: Create directories test1, test2, create a test1.txt file in test1, and then copy the test1.txt file to the test2 folder


Video data, pay attention to the WeChat public account "Kicked Xueba"

wechatCode(1)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324608680&siteId=291194637