The Linux Learning Touch command

Source: Internet
Author: User
Tags touch command

The Linux Learning Touch command
 linux's touch commands are typically used to change the date and time of a document or directory, including access time and change time, or create a new file that does not exist. 1. Command format: Touch [options] ... File... 2. Command parameters:-a   or--time=atime or--time=access or--time=use only change the access time. -C   or--no-create do not create any documents. -D uses the specified date time instead of the current time. -F This parameter ignores non-processing and is responsible only for compatibility issues with BSD version touch directives. -M   or--time=mtime or--time=modify only change the change time. -R Sets the date and time of the specified document or directory to the same date and time as the reference document or directory. -T uses the specified date time instead of the current time. --no-create will not create a new file.  --HELP lists the instruction format.  --version lists version messages. 3. Example: The simplest way to use a file is to change the time of recording to the present. If the file does not exist, a new file will be created.  touch File touch file1 File2 changed the time record of file to May 6 18:3, A.D. 2000. The format of the time can be referred to the date instruction, at least input mmddhhmm, is the day of the month and points. Security technology  touch-c-T 05061803 file touch-c-T 050618032000 file changes the file's time record to be the same as referencefile.  touch-r referencefile file changes the file's time record to May 6 18:3, A.D. 2000. Time can use AM, PM or 24 hours format, date can use other formats such as 6 May 2000.  touch-d "6:03pm" file touch-d "05/06/2000" file touch-d "6:03pm 05/06/2000" file Touch can also make an empty file (0 byte ). For example, the/ETC/DHCPD.LEASES,DHCPD required by DHCP server must have this file in order to function properly.  fInd/etc-name *-exec Touch {}; You can update the time of the profile to match the current setting. Set timestamp for file command: touch-t 201211142234.50 log.log  update log.log time and log2012.log timestamp same 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.