One linux Command every day (9): touch command

Source: Internet
Author: User
Tags touch command

One linux Command every day (9): touch command link: One linux Command every day (1): ls command http://www.bkjia.com/ OS /201210/163049.html#linuxlinuxcommand every day (2): cd command serial (3 ): pwd command Export (4): mkdir command http://www.bkjia.com/ OS /201210/1620.3.html#a linuxcommand every day (5): rm command Export (6): rmdir command http://www.bkjia.com/ OS /201210/164017. Html; a linux Command every day (7): mv command http://www.bkjia.com/ OS /201210/161097.html?a linuxlinuxcommand every day (8): cp command http://www.bkjia.com/ OS /201210/164254.html linux touch command is not commonly used, generally used when using make, used to modify the file timestamp or create a new file that does not exist. Www.2cto.com 1. command Format: touch [Option]... file... 2. command Parameters:-a or -- time = atime or -- time = access or -- time = use only change the access time. -C or -- no-create does not create any documents. -D uses the specified date and time instead of the current time. -F this parameter will not be processed. It is only responsible for solving the compatibility problem of the BSD touch command. -M or -- time = mtime or -- time = modify only changes the change time. -R sets the date time of the specified document or directory to the same as the date time of the reference document or directory. -T uses the specified date and time instead of the current time. Www.2cto.com 3. Command function: touch command parameters can change the date and time of the document or directory, including the access time and change time. 4. example: instance 1: run the "touch log2012.log log2013.log" command to create a non-existent file. Output: [root @ localhost test] # touch log2012.log log2013.log [root @ localhost test] # ll-rw-r -- 1 root 0 10-28 16:01 log2012.log-rw-r -- r -- 1 root 0 10-28 16:01 log2013.log if log2014.log does not exist, do not create a file [root @ localhost test] # touch-c log2014.log [root @ localhost test] # ll-rw-r -- 1 root 0 10-28 01 log2012.log- rw-r -- 1 root 0 10-28 16: 01 log2013.log instance 2: Update log. the log time is the same as that of log2012.log: touch-r log. log log2012.log output: [root @ localhost test] # ll-rw-r -- 1 root 0 10-28 16:01 log2012.log-rw-r -- 1 root 0 10-28 16:01 log2013.log -rw-r -- 1 root 0 10-28 log. log [root @ localhost test] # touch-r log. log log2012.log [root @ localhost test] # ll-rw-r -- 1 root 0 10-28 14:48 log2012.log-rw-r -- 1 root 0 10- 28 log2013.log-rw-r -- 1 root 0 10-28 log. log Example 3: Set the file timestamp command: touch-t 201211142234.50 log. log output: [root @ localhost test] # ll-rw-r -- 1 root 0 10-28 14:48 log2012.log-rw-r -- 1 root 0 10-28 16:01 log2013.log -rw-r -- 1 root 0 10-28 log. log [root @ localhost test] # touch-t 201211142234.50 log. log [root @ localhost test] # ll-rw-r -- 1 root 0 10-28 log 2012. log-rw-r -- 1 root 0 10-28 16:01 log2013.log-rw-r -- 1 root 0 2012-11-14 log. log Description:-t time uses the specified time value time as the new value of the corresponding time stamp of the specified file. the time here is defined as the following decimal number: [[CC] YY] MMDDhhmm [. SS] Here, CC is the first two in the number of years, that is, the number of centuries. YY is the last two in the number of years, that is, the number of years in a century. if no CC value is provided, touch limits the number of years CCYY to within 1969--2068. MM indicates the number of months. DD indicates the number of years CCYY is limited. MM indicates the number of months, DD indicates the number of days, hh indicates the number of hours (when), mm indicates the number of minutes, and SS indicates the number of seconds. the second is set to 0--61, which can process leap seconds. the time composed of these numbers is a time zone specified by the Environment Variable TZ. due to system restrictions The time of January 1, January 1, 1970 is incorrect.

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.