Delete files in linux. Detailed explanation of the rm command for folder commands

Source: Internet
Author: User

In Linux, the main command used to delete files in folders is rm. The following describes how to delete linux rm.

Syntax:

Rm [Option] DirName

The [Options] In this command are commonly used in the following ways:
 
-I ask for confirmation one by one before deletion

-F the deleted object is directly deleted even if its attribute is read-only. You do not need to confirm it one by one. By default, the object needs to be confirmed one by one.

-R: delete directories and all the following files one by one.

Example:

Rm-I *. php deletes all documents suffixed with php. Ask for confirmation one by one before deletion.

Rm-r phpernote: delete all the files in the phpernote directory and subdirectory. When the file is read-only, a message is displayed indicating whether to delete the file.

Rm-rf/var/access will delete the/var/access Directory and all files and folders under it. No confirmation prompt will be sent when you delete the directory.

Note:

(1) There is no recycle bin in linux, so when using the rm command, remember that the files or directories cannot be restored after they are deleted.

(2) If you are prompted that you do not have the permission to run the command, you can use sudo to escalate the user's permission and then execute the command.

Articles you may be interested in
  • Linux chmod (file or folder permission setting) command parameters and Usage Details
  • Linux File Content statistics command wc command usage details
  • Create a folder (mkdir) command in linux
  • Php clears (deletes) the files in the specified directory, and does not delete the directory folder.
  • Summary of linux Command for viewing File Content
  • How many lines of files can be viewed in linux?
  • Linux File Creation (touch) command details
  • Linux Command file directory management cat command

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: info-contact@alibabacloud.com 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.