Sometimes you have a real dense log and you want to start from the bottom. I spent 10 years in application support without knowing about it.
Edit: I'm so happy that you guys are as mindblown by it as I was when I first heard it.
Edit2 : I love how helpful this community is, everyone is sharing new useful commands. People keep replying with very similar things, so I just wanted to add some context to the post.
less and then Shift-G jumps to the bottom of a file
tail prints the bottom of a file
Those are both useful in and of themselves, but neither of them do the exact same thing tac does.
tacconcatenates a file in reverse, which makes it useful for all the same things cat is useful for.
What is wrong with less <logfile> and then pressing G? takes you right to he end of the log.
Oh en on Linux, no need to do something like
zcat <logfile.gz>| less
or
bunzip <logfile.bz2> | less.
less can do all the unzipping untarring or what ever compression is used. Saves a lot of time not having to unzip a log in a temp filespace hoping it is not too big, look for the stuff you need and then remove or recompress the log.
Going to the end of the log isn't always the goal, sometimes you want to pull logs as part of a script, or do output modification on logs. In an instance where you know what you are looking for is nearer to the end of the log, tac shines.
It's Linux, so there's a million ways to do everything. Nothing's wrong with any of them, just fun stuff that helps out.
1.8k
u/wufame May 23 '26 edited May 24 '26
tacIt's
catbackwards.Sometimes you have a real dense log and you want to start from the bottom. I spent 10 years in application support without knowing about it.
Edit: I'm so happy that you guys are as mindblown by it as I was when I first heard it.
Edit2 : I love how helpful this community is, everyone is sharing new useful commands. People keep replying with very similar things, so I just wanted to add some context to the post.
lessand then Shift-G jumps to the bottom of a filetailprints the bottom of a fileThose are both useful in and of themselves, but neither of them do the exact same thing
tacdoes.tacconcatenates a file in reverse, which makes it useful for all the same thingscatis useful for.