The Power of Touch

The Power of Touch

If you are using Linux or some kind of Unix you may have noticed the command touch.

touch [-acm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file [...]

Mostly, it is used to create empty files, e.g. to create an empty file called new.txt:

touch new.txt

But it can do much more! Originally it was build to manipulate the modification and access time of files. E.g. if you want to trick make to recompile a project just touch a file:

touch project.c

Sometimes, if you work with NFS drives of servers with asynchronous time stamps, some applications do not recognize updated files and will work with a cached version for some time. You can use a dirty work around, e.g.:

touch -m 209901018000 cachedfile.txt

Or set all files of a folder to the identical timestamp …

Have a look at the man page for more information.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *