Skip to content

Instantly share code, notes, and snippets.

@jftuga
Last active August 9, 2024 22:06
Show Gist options
  • Save jftuga/c31f00915863b463cf1ca16330876061 to your computer and use it in GitHub Desktop.
Save jftuga/c31f00915863b463cf1ca16330876061 to your computer and use it in GitHub Desktop.
Using the LESS environment variable

set LESS environment variable to: -SXIFRs in your .bash_profile or .bashrc:

  • -S: chop lines, side scroll with left/right arrow keys
  • -X: leave contents on screen when less exits
  • -I: ignore case when searching with / or ?
  • -F: quit immediately when the entire file fits in one screen
  • -R: enable colored output
  • -s: squeeze blank lines into a single blank line

useful:

  • -N: line numbers
  • -F: force open non-regular files
  • -R: Causes raw control characters to be displayed, but only ANSI "color" escape sequences
  • -p: equivalent to specifying +/pattern;
    • that is, it tells less to start at the first occurrence of pattern in the file
  • --incsearch: incremental search
  • --mouse --wheel-lines=10: let the mouse wheel scroll 10 lines at a time
  • To start at a specific line number, say line 150, use less +150 filename

note: these options are compatible with bat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment