The Linux learning Note 9--touch command is used

Source: Internet
Author: User
Tags parse string time and date touch command

NAME
Touch-change file Timestamps--changing the time History of files

Synopsis
Touch [OPTION] ... FILE ...

DESCRIPTION
Update the access and modification times of each FILE to the current
Time. --Use the touch command to change the date and time of a file or directory, including access time and change time.

Mandatory arguments to long options is Mandatory for short options
Too.

-A change only the access time-changes the file's read history

-C,--no-create
Don't create any files--if the target does not exist, no new issues are created.

-D,--date=string
Parse STRING and use it instead of the current time
--Set the format of the time and date, not the current time.
-F (ignored)-not used, reserved for compatibility with other UNIX systems

-M change is only the modification time--only changes are made

-R,--reference=file
Use the This file echnical's times instead of the current time
--Set the date and time of the specified file or directory to the same date and time as the reference file or directory
-T STAMP
use [[CC]YY]MMDDHHMM[.SS] instead of the current time
--Set the format of the time and date, not the current time.

When the command is used. I know here that I can use it to create an empty file.
Such as:
[[email protected] ~]$ Touch AA--Build a file of AA
[Email protected] ~]$ ls-l--full-time--The case in Linux is very sensitive, just like C.
ls:unrecognized option '--full-time '
Try ' ls--help ' for more information.
[[email protected] ~]$ ls-l--full-time--Display list
Total 12
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:11:49.000000000 +0800 AA
Drwxrwxr-x 2 ok_008 ok_008 4096 2007-09-28 17:05:35.000000000 +0800 ok008filed
[[Email Protected]tos4 ~]$ Touch {bb.txt,cc.txt,dd.txt}
[Email protected] ~]$ ls-l--full-time
Total 24
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:11:49.000000000 +0800 AA
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:28.000000000 +0800 bb.txt
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:28.000000000 +0800 cc.txt
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:28.000000000 +0800 dd.txt--Notice the time of this line
Drwxrwxr-x 2 ok_008 ok_008 4096 2007-09-28 17:05:35.000000000 +0800 ok008filed

[[email protected] ~]$ Touch {dd.txt,ee.txt}--here to re-establish multiple files, note that dd.txt and the previous code write Dd.txt time display.
[Email protected] ~]$ ls-l--full-time
Total 40
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:11:49.000000000 +0800 AA
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:52.000000000 +0800 bb
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:28.000000000 +0800 bb.txt
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:52.000000000 +0800 cc
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:28.000000000 +0800 cc.txt
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:12:52.000000000 +0800 DD
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:13:13.000000000 +0800 dd.txt--Notice the time of this line
-rw-rw-r--1 ok_008 ok_008 0 2007-09-28 17:13:13.000000000 +0800 ee.txt
Drwxrwxr-x 2 ok_008 ok_008 4096 2007-09-28 17:05:35.000000000 +0800 ok008filed
[Email protected] ~]$
[[Email protected] ~]$ RM aa BB bb.txt cc cc.txt DD dd.txt ee.txt--delete several empty files just created
[[email protected] ~]$ ls
Ok008filed

This may explain the effect of the touch command, which is known in reference and in practice for its modified meaning.

The Linux learning Note 9--touch command is used

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.