ODOC: less

less — Filter for paging through text one screen full at a time.


It is a filter for showing the text in page by page format to user. It supports No. of commands for screen operations, different prompts and Input Preprocessing. Less will show big files in faster manner.


$ less myfile — Show the file content in page by page format.

$ less -c myfile — Clear the screen before showing next screen.

$ less -q myfile — Exit after 2nd time reaches end-of-file.

$ less -G myfile — High-lite all searched strings.

$ less -pMail myfile — Start at the 1st occurrence of pattern “Mail”

$ less -P%B myfile — Last line prompt will show the file size.

$ less xyz.rpm — RPM file infos.

$ less xyz.tar — List all files in the tar file.

$ less xyz.zip — List all files in the Zip file.


  • Press q to exit from less.
  • Press ! to execute the shell command
  • Press !! to rerun the last shell command
  • Press ^l to refresh the screen.
  • Press /pattern for search.


  • User can write own preprocessing script by editing lesspipe.sh.
  • User can build own key mapping by running lesskey command.
  • If env variable LESSSECURE is set to 1, then it runs in a “Secure” mode. No Shell, Pipe, Examine and Editing command are disabled.
  • Less will not read entire file content in 1st read.

Read: man less

less, odoc, linux, gnu/linux