Motivation

lesspipe.sh is a preprocessor for the less pager that transforms non-text files into readable text format and can enhance readability by colorizing the output. Several variants of such a preprocessor do exist.

This version has been designed with accuracy in mind. It guesses the file type using the file command and for ambiguous cases file extension matching as a last resort. Depending on the type textual information of the file is generated using helper programs. Where appropriate syntax highlighter programs can colorize the output.

Features

lesspipe.sh enables less to display:
  • Compressed files (gzip, bzip2, xz, zstd, lz4, brotli, lzma)
  • Archive contents (tar, zip, rpm, deb, rar, 7z, iso, cpio, cab)
  • Document formats (PDF, MS Office, LibreOffice, RTF, HTML, XML, markdown)
  • Media file metadata (MP3, images, video files via ffprobe/exiftool)
  • Binary formats (shared libraries, Java .class files, device tree blobs)
  • Nested hierarchies (files within archives within compressed archives, up to 6 levels deep)

Sample output