Linux mkdir and Touch command difference __linux

Source: Internet
Author: User
Tags touch command

Original address: http://www.cnblogs.com/zfyouxi/p/5371317.html

Purpose This article will introduce Linux under new files or folders, delete files or folder commands.
Touch to create a new file, mkdir to create a new folder. RM is used to delete files or folders.
This paper will choose ubuntu14.04 distribution as the basis of descriptive narration.

second, Touch command Linux under the way there are a lot of new files, such as: Use VI to create a new file, use the CP command to copy a file, but most often use the touch command to create a new file.


Grammar: Touch [options] FileName
-A: Changing access time
-M: Changing the time of change
-t timestamp: Changing access time and change time to timestamp

Suppose you do not specify whatever option. Then the touch command creates a new file.

Assuming the-t timestamp option is specified, the touch command changes the file's access time and the change time to timestamp.


Assuming the-a option is used, the touch command changes the file's access time to the current time.


Assuming the-m option is used, the touch command changes the file's change time to the current time.




iii. mkdir command syntax: mkdir [Options] DirName
-P: Recursively create a folder
-mmode: Create a new folder and set file interview mode for folder

Create the Zsy/hxn folder recursively using the-p option.


Use the-M option to specify a new folder file access mode is 770, that is, rwxrwx---。


RM Command syntax: RM [Options] Filename/dirname
-F: Force delete file or folder, even if the folder is not empty
-r: Recursive delete files or folders
-I: Need to confirm before deleting files or folders

In the actual use. The-R and-F options are commonly used at the same time to force, recursively delete the specified file or folder.


For critical files or folders, it is recommended that the-I option be used when deleting. Avoid misoperation.



v. Summary

This article describes the new File command touch under Linux, the new Folder command mkdir, and the delete file or Folder command RM.

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.