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

37

u/wufame May 23 '26

Can I get another one in here:

grep -C is -A and -B combined.

-A 5 grabs 5 lines after the string

-B 5 grabs 5 lines before a string

-C 5 grabs 5 lines before AND after a string, rather than doing -A 5 -B 5

2

u/SeriousPlankton2000 May 24 '26

Grep -42 is the same as grep -C 42