Resolve Linux folder file creation, delete _linux

Source: Internet
Author: User
Tags create directory mkdir touch

This article mainly introduces the folder file creation, deletion, specific as follows:

Linux Delete Folder command

Linux Delete directory is very simple, many people are still accustomed to using rmdir, but once the directory is not empty, into deep distress, now use the RM-RF command.
Direct RM is OK, but add two parameters-rf namely: RM-RF directory Name

Delete directory, file rm (remove)

Feature Description: Deletes a file or directory.

Syntax: RM [-dfirv][--help][--version][file or directory ...]

Supplemental Note: Perform RM directives to delete files or directories, and if you want to delete the directory you must add the parameter "-r", otherwise the preset will only delete the file.

Parameters

-D or –directory deletes the hard connection data of the directory to be deleted directly to 0, deleting the directory.
-F or –force forcibly deletes a file or directory.
-I or –interactive ask the user before deleting the existing file or directory.
-R or-R or –recursive recursively, all files and subdirectories under the specified directory are processed together.
The-V or –verbose displays the instruction execution process.

1 Deleting folders

 
 

-Delete Folder instance:

Rm-rf/var/log/httpd/access

The/var/log/httpd/access directory and all the files and folders under it will be deleted

Need to be reminded: Use this RM-RF must be extra careful, Linux has no Recycle Bin

2 Deleting files

De>rm-f filenamede>

You must be careful when using RM-RF, Linux does not have a recycle Bin

Linux Add File command

Create directory: mkdir (make Directories)

Function Description: Create a catalogue

Syntax: mkdir [-p][--help][--version][-m < directory properties >][directory name]

Supplemental Note: mkdir can create a directory and set permissions on the directory at the same time.

Parameters

-m< Directory properties > or –mode< Directory properties > Set permissions for the directory while establishing the directory.
-P or –parents if the top-level directory you want to create a directory is not currently established, the top-level directory is created together.

Cases:

mkdir test

Create a file Touch

Function Description: Change file or directory time.

Syntax: Touch [-acfm][-d < date time >][-r < reference file or directory >][-t < date time] [--help] [--version][file or directory ...] or touch [-acfm] [--help] [--version] [Date Time] [File or directory ...]

Supplemental Note: Use touch instructions to change the date and time of a file or directory, including access time and change time.

Parameters

Only the access time is changed by-A or –time=atime or –time=access or –time=use.
-C or –no-create does not create any files.
-d< Time Date > Use the specified date time, not the current time.
-F This parameter ignores no processing and is responsible for resolving the issue of compatibility of the BSD version of touch instructions only.
-M or –time=mtime or –time=modify only change the change time.
-r< reference file or directory > the date and time of the specified file or directory, all set to the same date and time as the reference file or directory.
-t< Date Time > Use the specified date time, not the current time.

Example: Touch test.txt (Note: Linux does not have a file suffix under the name of the file type, the system file type is only executable and cannot execute files)

Original link: http://www.cnblogs.com/end/archive/2012/06/05/2536835.html

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.