About me My attempt to store and visualize GraviTrax tracks Download lesspipe Archive |
Displaying more with less (Version 2.15 Oct 03, 2024)lesspipe.sh is an input filter for the pager less as described in less's man page. The script runs as a bash or zsh script and allows you to view files with binary content, compressed files, archives and files contained in archives. It supports many formats (both as plain and compressed files using gzip, bzip2 and other pack programs).Details can be found in the README.md file. Syntax highlighting of source code is possible through several programs such as nvimpager, bat, pygmentize or source-highlight. The included scripts code2color and vimcolor are also usable derived from older programs found in the internet and tailored for the use within lesspipe. Syntax highlighting and other methods of colorizing the output are only activated if the environment variable LESS is existing and contains the option -R or less is called with -R. This guarantees, that instead of literal escape sequences colors are displayed. The detection of the -R presence at runtime is rather dependent on the operating system and may not work in all cases. The script lesspipe.sh needs a lot of helper programs that may or may not be installed on your computer. The lesspipe.sh from version 2 on interactively checks for the existence of these helper programs. The script that does the colorization by default can be replaced by setting the LESSCOLORIZER env variable to the desired colorizer. Starting with version 2.01 tab completion of files within archives is possible. A colon or equal sign after the archive name followed by a tab key press engages the completion mechanism (bash and zsh) if properly installed. That requires the script lesscomplete to be executable and to be found in $PATH and for zsh the script called _less in one of the $fpath directories. For bash the less_completion script needs to be installed in /etc/bashcompletion.d/. The lesspipe.sh filtering can be replaced or enhanced by a user defined program. Such a program has to be called either .lessfilter (and be placed in the users home directory), or lessfilter (and be accessible from a directory mentioned in the environment variable $PATH). That program has to be executable and has to end with an exit code 0, if the filtering was done within that script. Otherwise, a nonzero exit code means the filtering is left to lesspipe.sh. This mechanism can be used to add filtering for new formats or e.g. inhibit filtering for certain file types.
To get support for newer file types an additional magic file (for use in the
file command, e.g. in ~/.magic) might have to be created. In that case the
environment variable MAGIC has to be set and has to contain both the system
magic file and your personal one. Example:
DownloadThe tarball lesspipe.tar.gz is available both from this site as well as from GitHub (branch lesspipe)The following files are available separately for download from this site (all contained in the tarball):
Older versions can be downloaded from the archive as well.
DocumentationHere is an incomplete list of old articles that did describe lesspipe.sh
german.txt article about the usage of lesspipe(in german, not up to date)
Linux Magazin 01/2001 The zip file of the latest released version and other files can be retrieved from github as well. |
This document
is maintained by
. |