View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Touch

From LQWiki

Jump to: navigation, search

Touch, by default, changes the timestamp for an existing file to the current date and time or, if the file named does not exist, creates it in the current directory. For example:

$ ls -l foo
-rw------- 1 user users 32 Mar 18 22:07 foo

$ touch foo

$ ls -l foo
-rw------- 1 user users 32 Mar 21 12:28 foo

sets the timestamp to the current time.

As another example, if .hushlogin did not exist:

$ cd
$ touch .hushlogin

creates a .hushlogin file in one's home directory, which suppresses the display of /etc/motd on login.

Among other options, a particular time may be specified with the -t option and file creation may be suppressed with the -c option.


Personal tools