mkdir and Touch command differences in Linux

Source: Internet
Author: User
Tags touch command

first, the purpose

This article describes the new file or folder, delete files, or folder commands under Linux. Touch is able to create new files and mkdir to create new folders. RM is used to delete files or folders. This article will choose the ubuntu14.04 release as a descriptive narrative basis.

second, Touch command

There are many ways to create a new file under Linux, such as using VI to create a new file, copying a file using the CP command, but most often using the touch command to create a new file.

Syntax: touch [options] filename -A: Changing the time to visit-m: changing the time to change-t timestamp: Change the access time and the change time to timestamp
Assume that no matter what option is specified. Then the touch command creates a new file.

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

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

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

iii. mkdir Order

Syntax: mkdir [options] dirname -P: Recursively create a folder-M mode: Create a new folder and set the folder's file access mode

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

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

Four, rm command

Syntax: RM [Options] Filename/dirname -F: Forcibly delete files or folders even if the folder is not empty- r: Recursively delete files or folders-I : delete files or folders before you need to To confirm
In the actual use. The-R and-f options are generally used at the same time to forcibly and recursively delete the specified file or folder.

For critical files or folders, it is recommended to use the-I option when deleting. Avoid accidental operation.

v. Summary

This article describes the new File command in Linux under Touch, the new Folder command mkdir, and the delete files or Folders command rm.

mkdir and Touch command differences in Linux

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.