Archive for July, 2009
Less is better, than tail
I’ve been using tail to watch my log files for years:
tail -f log/production.log
It works great all the time, until you want to search for something, then you have to ctrl+c and open the file in less or vi.
Maybe there is a better way? After some googling, I found less is the answer:
less +F log/production.log
less +F works exactly like tail -f, with more:
- Simply press ctrl+c to switch to editing model, so you can scroll backward and using any more/vi command, such as /pattern to search
- Press shift+f again to switch back to tail model
Anyway, just run man less to find some more information.