Linux Essays---Touch and mkdir

Source: Internet
Author: User
Tags touch command

first, the purposeThis article describes the new file or directory, delete files, or directory commands under Linux.
Touch can create a new file, mkdir to create a new directory, and RM to delete a file or directory.
This article will select the ubuntu14.04 release as the basis for the description.

second, Touch commandThere 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: Change access time
-M: Change the modification time
-T Timestamp: Change the access time and modify time to timestamp

If you do not specify any options, the Touch command creates a new file.

If the-t timestamp option is specified, the touch command modifies the file's access time and modification time to timestamp.


If the-a option is used, the Touch command modifies the file's access time to the current time.


if the-M option is used, the Touch command modifies the file's modification time to the current time.


iii. mkdir Ordersyntax: mkdir [options] dirname
-P: Recursively create a directory
- m mode: Create a new directory and set the file access mode for the directory as mode

The ZSY/HXN directory is created recursively using the-p option.


Use the-m option to specify that the file access mode for the new directory is 770, rwxrwx---。


Four, rm commandSyntax: RM [options] Filename/dirname
-F: Force a file or directory to be deleted, even if the directory is not empty
-r: Recursively delete files or directories
-I: Need confirmation before deleting files or directories

In practical use, the-R and-f options are generally used simultaneously to forcibly and recursively delete the specified file or directory.
for important files or directories, it is recommended to use the-I option when deleting, to avoid mis-operation.

v. Summary

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


Copyright Notice:original works, such as non-commercial reprint, please specify the source, such as commercial reprint publication, please contact the author.

Linux Essays---Touch and mkdir

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.