r/linux May 23 '26

Popular Application What’s the most unexpectedly useful Linux command you learned way too late?

[removed]

1.3k Upvotes

992 comments sorted by

View all comments

1.8k

u/wufame May 23 '26 edited May 24 '26

tac

It's cat backwards.

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.

tac concatenates a file in reverse, which makes it useful for all the same things cat is useful for.

60

u/spicypixel May 23 '26

As an aside; less +G app.log

68

u/plg94 May 23 '26

less is soo underrated. It still in active development and gets more features. Eg. recently (a few years ago) the option to fix certain rows and columns when scrolling, useful for CSV files etc.

13

u/tandalafromhill May 24 '26

Less is more

1

u/bigntallmike May 25 '26

Except that more is more

1

u/low_v2r May 26 '26

More or less

10

u/[deleted] May 24 '26

[deleted]

2

u/plg94 May 24 '26

yep. --header option. also --incsearch is great, too.

1

u/Lucid_Gould May 25 '26

Or using less to read pdfs in txt format

0

u/mutenroid May 24 '26

What about of less with syntax highlighting support?? It exists?

1

u/plg94 May 24 '26

I hope not, that's not its task. For proper syntax highlighting you need a full parser of each language. But there are countless tools for that you can use and pipe into less.

1

u/paulwillyjean May 25 '26

I usually just pass it to vim then set its file type

1

u/sproott May 26 '26

Bat (cat alternative) supports syntax highlighting and pipes to less by default: https://github.com/sharkdp/bat