HOWTO: Use the Touch Command.
Touch is a very simple, but incredibly useful GNU/Linux utility.
Touch is designed to literally ‘touch’ a file and change its timestamp to the current date and time. I can think of a few reasons why you might want to do this (updating an older data file to look current, for example), but I’ve found another use for it.
The command to touch a file is simply:
touch foo
One very useful side effect of touch is that it will create the file foo if it doesn’t exist. Many applications that I use on my web server require a configuration file to exist, but the install script will populate it with data so the file can (and in some cases, has to be) empty. Touch foo.config is a great way to create the file without having to fire up an editor.
As with all GNU/Linux commands, there are some switches that you can supply to modify touch’s behaviour. Use the man touch (eeeew!) or the info touch (better!) command to read more about touch.
Related Stories
POSTED IN: How To
0 opinions for HOWTO: Use the Touch Command.
No one has left a comment yet. You know what this means, right? You could be first!
Have an opinion? Leave a comment: