Brilliant tech writing in action
Yesterday, I needed to reverse the characters of a file on my linux box. That is, print the last character in the file first, then the second-to-last, and so on. Luckily, there are two programs to do this: rev and tac. They do slightly different things, and I never can remember which of these does what, so I tried looking at the whatis(1) output for rev(1).
$ whatis rev
rev (1) - reverse lines of a file
$
We are left to guess what this description really means. Either:
- Reverse the order of lines of a file
- Reverse the order of characters within each line of a file.
Um. My guess at the time was the first option. Let’s see what tac(1) does, then!
$ whatis tac
tac (1) - concatenate and print files in reverse
$
Hey, I can write a descripiton that’s worse than this!
$ phantasy-whatis tac
tac (1) - reverse lines of a file
$
Turns out that the solution to my problem was tac | rev. Try and figure out which does what. Hint: the actual DESCRIPTION section in each man page really explains what the command does.