I learned a new command today. It was such a simple one, I can’t believe i’ve never heard of it before or seen anyone else use it.
It’s nice to be able to ‘cat’ dated logs that are split into multiple files with a simple command
cat /var/log/messages*
but that leaves you with the dates mixed up. There’s an easy solution: cat, backwards!
tac /var/log/messages*
Tada.
From the man page:
NAME
tac - concatenate and print files in reverseSYNOPSIS
tac [OPTION]… [FILE]…DESCRIPTION
Write each FILE to standard output, last line first. With no FILE, or when
FILE is -, read standard input.Mandatory arguments to long options are mandatory for short options too.
-b, –before
attach the separator before instead of after-r, –regex
interpret the separator as a regular expression-s, –separator=STRING
use STRING as the separator instead of newline–help display this help and exit
–version
output version information and exit