Linuxtouch command usage explanation command name: touch permission: all users use: www.2cto. comtouch [-acfm] [-rreference-file] [-- filereference-file] [-tMMDDhhmm [[CC] YY] [. ss] [-dtime] [-- datet...
Linux touch command usage explanation command name: touch permission: all users usage: www.2cto.com touch [-acfm] [-r reference-file] [-- file = reference-file] [-t MMDDhhmm [[CC] YY] [. ss] [-d time] [-- date = time] [-- time = {atime, access, use, mtime, modify}] [-- no-create] [-- help] [-- version] file1 [file2...] note: the touch command changes the time record of the file. Ls-l can display the time record of the file. Parameter: a changes the file read time record. M changes the modification time record of the file. C if the target file does not exist, no new file will be created. The same effect as -- no-create. F is not used. it is reserved for compatibility with other unix systems. R uses the time record of the Reference file, which has the same effect as -- file. D. set the time and date in different formats. T sets the time record of the file. the format is the same as that of the date command. -- No-create does not create a new file. -- Help lists the instruction formats. -- Version: list version information. 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. Www.2cto.com touch file touch file1 file2: change the time record of the file to, 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. 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" filetouch 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. [root @/root] # touch/etc/dhcpd. leases [root @/root] # ls-l/etc/dhcpd. leases-rw-r -- 1 root 0 Jul 3 05:50/etc/dhcpd. leases remembers to put the configuration file tar in/etc before the last refill, and restore the original configuration after the refill, but found that the system has a problem checking the time of the configuration file, in this case, use find/etc-name *-exec touch {}; to update the time of the specified file to the same as the current time. .
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.