less command

less packs more power than “more” or “tail” commands

tail -f like functionality

Usage: $ less +F file.log

If only $ less file.log is invoked pressing F will switch back to mode similar to tail -f

Enable row number

-NR inside less enables row number

Disable wrap

-S toggles word wrap

 

Finally, launching less with the following does it all

less +F -NR file.txt

 

Opening compressed .gz files with less

Initial setup

touch ~/.lesskey

# Add below content to file
##env
#LESSOPEN=|/bin/lesspipe %s

# Execute below command
lesskey

reference

 

HTH

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *