Linux Learning notes: Basic instruction mkdir, rmdir, and RM

Source: Internet
Author: User


mkdir Creating a folder
mkdir (make directory) is the idea of creating a folder, which is simple to use.

$ mkdir Folder2

If you want to create a folder for Folder2 inside this directory is Ok.

$ mkdir FOLDER2/F2
In this way, the F2 folder is built into the Folder2.

rmdir removing folders
RmDir (remove directory) is literally meant to remove a folder. But there is a precondition. The folders that you want to remove must be empty. Otherwise it will fail. So if you want to just build the folder2 can not be removed, because there is a F2 folder.

To remove an empty folder, for example, I'm creating a new folder3 and then removing

$ rmdir Folder3

rm Remove files from
That's the case with files in that folder, or we can use RM to remove individual files. Note: After performing RM is not able to return operations, make sure not to perform operations like this RM/, which will empty your computer.

1 Removing a single file

$ RM file1
2-I or-I are prompted to remove the file (in order to avoid accidental deletion)

-i will prompt for each file to be removed
-i more than 3 files to prompt
$ RM -I F1 F2 F3 f4
rm:remove regular empty file ' F1 '?
rm:remove regular empty file ' F2 '? y
Span style= "font-family:"microsoft yahei"" >rm:remove regular empty file ' F3 '?
rm:remove regular empty file ' F4 '? y
$ rm-i F1 F2 f3 f4
rm:remove 4 arguments? Y
3 -R or-R (recursively) is used to delete folders

Unlike RmDir, Rm-r can delete this folder if there are files in the folder. For example, there are two files of file1 and file2 in my folder1.

$ rm-r Folder1

Linux Learning notes: Basic instruction mkdir, rmdir, and RM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.