Scratchpad - LSD - A colorful ls alternative

lsd demo

lsd is an alternative to the classic ls UNIX tool. It shows you a listing of files, directories, links, named pipes etc. The difference to its predecessor is that it makes use of Glyph-rich fonts such as Nerd Fonts as well as an abundance of colors preconfigured and available from start.

Common Issues

  • You’re getting “Permission denied” when root or a $LD_PRELOAD error on a gtk3-related library

    You’ve probably installed lsd via snap. Don’t; Either build it from source or install it with apt.

  • Use lsd and redirect its output

    You might notice that when redirecting lsd output to e.g., a file, lsd detects that its output is not actually a terminal and turns off coloring and glyphs. Most of the time that’s the correct behavior, otherwise it would pollute the output file with escape characters for the colors. However if you still want to keep colors and glyphs on, here’s how you would do it

    ls --tree --icon always --color always | less -r
    # Or if piping to a file
    ls --tree --icon always --color always | tee -a output-file