One day a shell command Linux text Manipulation Series-touch command usage _linux shell

Source: Internet
Author: User
Tags current time touch command

We've studied DD before. Create a test file, if you do not need to consider the size of the file, create a blank file, you might want to try

Touch:

Change the access time and modification time of each file to the current time.
Files that do not exist will be created as empty files unless the-C or-h option is used.

Examples of getting Started:

1. If you want to generate 100 empty files

For name in {1..100}.txt does touch 
$name 

2. Improve

Touch test{1..20}.c

View--help

Usage: Touch [options] ... File...
Change the access time and modification time of each file to the current time.
Files that do not exist will be created as empty files unless the-C or-h option is used.

If the file name is "-" special processing, change the access time of the file associated with the standard output.

Parameters that must be used for long options are also required for short options.
-A Change access time only
-C,--no-create does not create any files
-D, the--date= string uses the specified string to represent the time rather than the current time
-F (ignored)
-H,--no-dereference affects the symbolic link itself, not the destination indicated by the symbolic link
(This option is useful when the system supports changing the owner of the symbolic link.)
-M change modification time only
-R, the--reference= file uses the time attribute of the specified file instead of the current time
-T STAMP use [[CC]YY]MMDDHHMM[.SS] format time instead of the current time
--time=word time specified with WORD: Access, atime, use are equal to-a
Effects of options, while modify, Mtime equals-M options
--HELP displays this help information and exits
--version display version information and exit

Note that the-D and-t options can accept different time/date formats.

Interpretation:

1. D uses the specified string to represent the non current time

$touch-D "Fri June 20:50:14 IST 1999" FileName

This is a simple command, a lazy day ...

More detailed methods can refer to this article: http://www.jb51.net/LINUXjishu/257946.html

Related Article

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.