Touch Command for Linux learning

Source: Internet
Author: User
Tags touch command
Linux touch command is generally used to change the date and time of a document or directory, including the access time and change time, or to create a new file that does not exist. 1. command format: touch [option]... file... 2. command parameters:-a or -- timeatime or -- t... linux touch command is generally used to change the date and time of a document or directory, including the access time and change time, or to create a new file that does not exist. 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. -- No-create does not create a new file. -- Help lists the instruction formats. -- Version: list version information. 3. example: the simplest way to use archive records is to change the current time. If the file does not exist, the system creates a new file. Touch file touch file1 file2: change the time record of file to a.m. on January 1, May 6, two thousand a.m. For the time format, refer to the date command. at least MMDDHHmm must be input, that is, the time of the month, day, and minute. Security Technology touch-c-t 05061803 file touch-c-t 050618032000 file changes the time record of the file to the same as referencefile. Touch-r referencefile: change the time record of file to a.m. on January 1, May 6, two thousand a.m. The time can be in the am, pm, or 24-hour format. the date can be in another format, such as 6 May 2000. Touch-d "6:03 pm" file touch-d "05/06/2000" file touch-d "6:03 pm 05/06/2000" file touch can also create an empty file (0 byte ). for example, the/etc/dhcpd required by the DHCP Server. leases and dhcpd must have this file to operate normally. find/etc-name *-exec touch {}; then you can update the time of the specified file to be consistent with the current time. Set the file timestamp command: touch-t 201211142234.50 log. log the same time as the log2012.log timestamp command: touch-r log. log log2012.log

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.