Linux folder and file creation Delete command

Source: Internet
Author: User
Tags create directory touch command

Linux Delete Folder command

Linux Delete directory is very simple, many people are still accustomed to use rmdir, but once the directory is not empty, it fell into deep distress, now use the RM-RF command.
Direct RM is available, but add two parameters-rf that is: RM-RF directory name

Delete directory, file rm (remove)

Feature Description: Delete files or directories.
Syntax: RM [-dfirv][--help][--version][file or directory ...]
Additional Note: The Execute RM instruction can delete the file or directory, if you want to delete the directory must add the parameter "-r", otherwise the default will only delete the file.
Parameters
-D or –directory delete the hard connection data for the directory that you want to delete directly by deleting the directory by 0.
-F or –force forces the deletion of files or directories.
-I or –interactive to ask the user before deleting both files or directories.
-R or-R or –recursive recursively handles all files and subdirectories under the specified directory.
-V or –verbose shows the instruction execution process.

1 Deleting a folder
DE>RM-RF filenamede>

-Delete a folder instance:
Rm-rf/var/log/httpd/access

The/var/log/httpd/access directory and all files and folders under it will be deleted
To be reminded: Use this RM-RF with extreme caution, Linux does not have a recycle Bin

2 Deleting files
De>rm-f filenamede>
Use RM-RF with extreme caution, Linux does not have a recycle Bin

Linux Add Files command

Create directory: mkdir (make Directories)

Function Description: Create a directory
Syntax: mkdir [-p][--help][--version][-m < directory properties >][directory name]
Supplemental Note: mkdir can create a directory and set permissions for the directory at the same time.
Parameters
-m< Directory properties > or –mode< Directory properties > set directory permissions at the same time when the directory is established.
-P or –parents if the upper-level directory to which you want to create the directory is not currently established, the upper-level directory will be created.
Example: mkdir test
Create a file Touch

Function Description: Change the file or directory time.
Syntax: Touch [-acfm][-d < datetime >][-r < reference file or directory >][-t < datetime;] [--help] [--version][file or directory ...] or touch [-acfm] [--help] [--version] [Date Time] [File or directory ...]
Supplemental Note: Use the touch command to change the date and time of a file or directory, including access time and change time.
Parameters
-A or –time=atime or –time=access or –time=use only change the access time.
-C or –no-create does not create any files.
-d< Time Date > Use the specified datetime, not the current time.
-F This parameter ignores non-processing and is responsible only for compatibility issues with BSD version touch directives.
-M or –time=mtime or –time=modify only change the change time.
-r< reference file or directory > set the date and time of the specified file or directory to the same date and time as the reference file or directory.
-t< Date Time > Use the specified datetime, not the current time.
Example: Touch test.txt (Note: Linux does not have file suffix name to differentiate file type, System file type only executable files and non-execute files)

Linux folder and file creation Delete 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.