Here are a couple of commands, tac and touch.
I have never used the first one, but according to the manual page, and the tests I have done, tac is the reverse of cat, as the name suggest. It is used like this:
It will print the file in the screen (I mean, the terminal from which you are working, known as standard output) with lines in reverse order, from the last line to the first.
The second command, touch is more useful. It changes the dates of a file. Here is an example:
This will change the access time and the modification time to the current date in the computer. If you want to change only the access time you should give the option -a; for the modification time change you have to give the option -m.
If the file does not exist, then the command will create an empty file with the corresponding times.
You can change to any time (within the limits of the Operating System) with a command like this:
The format of the time (the number 200502011323 above) is of this type: YYYYMMDDhhmm. Here is the explanation:
- YYYY: the year
- MM: the month
- DD: the day of the month
- hh: the hour
- mm: the minute
So the time given in the string 200502011323 is translated to 1st (DD=01) of February (MM=02) of 2005 (YYYY=2005), 1 PM (hh=13), 23 minutes (mm=23).
Why would you want to change the date of a file? Well, some times programs depend on the date (modification/access) of a file, and they will not run if the file is too new or too old. So using touch you can make the program work. It happens, for example, if your machine’s time gets messed, and the file has a modification time in the future. The program make uses a file called Makefile; if the time of that file is in the future, make will not work; using touch you can change the date of the Makefile and get to business.