I keep seeing people typing these lines in the console:
$ tail /path/to/some.log
$ tail -f /path/to/some.log
$ tail -f /path/to/some.log
This is often a dumb thing to do. Why? Because you can’t really do anything with tail. What if you discovered you needed to look at something right above the lines you got printed out? Or what if you were -f’ing and something flew past you that you needed to investigate further? You’d have to leave tail and run it again with more lines or use a different tool instead. Not very practical.
What more people should do is to use less tail and more less ๐
$ less /path/to/some.log
Things you can do with less
Key | Function |
---|---|
รขโ โ | Up one line |
รขโ โ | Down one line |
b | Up one page |
space | Down one page |
g | Beginning of file |
G | End of file |
F | Follow |
ctrl + c | Stop follow |
q | Quit |
/ | Search forward |
? | Search backwards |
n | Next search result |
N | Previous search result |
Much more flexible and handy than tail! Know your tools ๐ Now back to work…