touch (Unix)

from Wikipedia, the free encyclopedia

touch is a Unix command line program for changing the access and modification time stamps ( atime and mtime ) of a file or directory. It is a standard program for Unix-like operating systems based on the POSIX standard that appeared in version 7 of AT & Ts Unix . The program uses the POSIX system call utime(2) , which works to the nearest seconds. In BSD systems the function has utime(3)been utimes(2)replaced by. The function utimensat(2)in the Linux kernel can change the time stamps to the nanosecond.

With touch can not ctime(-Stempel Change - or Creation -Stempel ie change or creation timestamp) to change a file.

service

The touch program is called via the command line with the command touchand a file specification. A time can be specified according to the Unix time. If no time is given, the current system time is used. If the specified file does not exist, it will be created unless an option prevents it. It is therefore also used to create (empty) files without further processing. Options can be specified to determine the behavior of the program. The options -a, -c, -m, -rand -tare in POSIX standardized.

Options

-a

only changes the access stamp (access time)

-c

do not create new (empty) files if the name of a nonexistent file is given

-d, --date=STRING

analyzes STRING and uses it instead of the current time

-f

(is ignored)

-m

only changes the modification stamp (modification time)

-r, --reference=FILE

uses the times from the specified reference file instead of the current time

-t STAMP

uses the [[CC]YY]MMDDhhmm[.ss]time specified in the format instead of the current time

--time=WORD

changes the specified time:
WORD can be: access, atime, use (equivalent to -a)
WORD can be: modify, mtime (equivalent to -m)

--help

displays help and exits the program

--version

outputs the version information and exits the program

Other operating systems

Programs that perform similar operations are also available for other operating systems such as Microsoft Windows and Mac OS Classic .

Web links

Individual evidence