This subchapter looks at touch, a Unix (and Linux) command.
Use touch to change the date stamp on a file.
Teach Yourself Unix/Linux System Administration and Shell Programming
table of contents
If you like the idea of this project,
then please donate some money.
more information on donating
This subchapter looks at touch, a Unix (and Linux) command.
Use touch to change the date stamp on a file.
The most common use of touch is to force make to recompile a particular file (or group of files).
The simple form of touch changes a named files timestamp to the current date and time:
$ touch filename
Use touch to change all of the files in a directory:
$ touch *
You can use touch to set a specific time by using the -t option. The following command sets a file to the Solstice at the end of the Mayan calendar (11:12 a.m. December 21, 2012):
$ touch -t201212211112.00 filename
The following command sets a file to the noon on January 1, 2012:
$ touch -t201201011200.00 filename
The format is YYYYMMDDhhmm.ss, YYYY = four digit year, MM - two digit month, DD = two digit day, hh = two digit hour (24 hour clock), mm = two digit month, and ss = two digit second.
You can use touch to create an empty file. Simply issue the touch command with the desired file name.
$ touch filename
This will create an empty file with the designated file name.
Why would you want to do this? One common reason is to create an expected file. Some scripts will check for the existence of particular files and choke if they cant find them. If the script does not need particular data alreazdy stored in the file (for example, it will be appending data intot he file or it is simply checking for the existence of the file), then touch is your fast and easy method for creating the expected file (as an empty file).
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
This section is under the category of owning cirticism.
In response to a posting about my article collecting social media, Moderator +Andrew Smith (Technology addict, Web Developer, API guru, futsal and football wannabe, and all round nice guy!, Swordfox Design, arrowtown, new zealand) of the Google+ community Web Developers, Web Designers, Web Coding claims Quite frankly this is self promotion, and your site is not of great quality. I can see how +Joost Schuurハ would think this of not high enough a standard.
return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Teach Yourself Unix/Linux System Administration and Shell Programming
Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.
If you like the idea of this project,
then please donate some money.
send donations to:
Milo
PO Box 1361
Tustin, California 92781
Supporting the entire project:
If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)
Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.
This web site handcrafted on Macintosh computers using Tom Benders Tex-Edit Plus and served using FreeBSD .
UNIX used as a generic term unless specifically used as a trademark (such as in the phrase UNIX certified). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.
Names and logos of various OSs are trademarks of their respective owners.
Copyright © 2012, 2014 Milo
Created: July 9, 2012
Last Updated: July 18, 2014
return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book