How to Install and Use lsd in Linux for a Modern Next-Generation ls Command

The standard Unix ls command has been the cornerstone of file navigation for decades, yet its default text output often feels spartan and uninformative on modern high-resolution terminal emulators. Distinguishing between directories, symlinks, binary executables, archive formats, and source files at a glance requires reading long permission strings or configuring complex LS_COLORS variables manually. lsd (LSDeluxe) is a modern, next-generation rewrite of ls engineered in Rust. It supercharges file listing with vibrant colour palettes, Nerd Font iconography, visual tree rendering, Git status badges, and intelligent human-readable sizing, all while maintaining lightning-fast performance.

What Is lsd and Why Choose It Over Classic ls?

lsd was created to modernise command-line directory inspection without sacrificing backwards compatibility with familiar Unix flags.

Key advantages of incorporating lsd into your Linux environment include:

  • Vibrant Iconography: Automatically parses file extensions and MIME types, rendering distinctive file and directory glyphs using Nerd Fonts.
  • Integrated Tree View: Combines the functionality of ls and tree into a single binary, supporting depth limits and directory filtering.
  • Git Status Integration: Displays file modification states, untracked indicators, and staged statuses directly alongside file entries.
  • Configurable YAML Theming: Customise colours, layouts, date formatting, and icon themes via an intuitive configuration file.
  • Rust-Powered Speed: Employs multithreaded directory traversal and zero-cost abstractions, listing multi-thousand file directories instantly.

Installing lsd on Linux

lsd is packaged across major Linux distributions and can also be installed using Cargo or pre-compiled binaries.

Method 1: Installing via APT (Ubuntu and Debian)

sudo apt update
sudo apt install lsd -y

Note: If your Debian or Ubuntu release lacks the package, download the official .deb release from GitHub:

LSD_VER=$(curl -s "https://api.github.com/repos/lsd-rs/lsd/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lsd.deb "https://github.com/lsd-rs/lsd/releases/download/v${LSD_VER}/lsd_${LSD_VER}_amd64.deb"
sudo dpkg -i lsd.deb
rm lsd.deb

Method 2: Installing via DNF or Pacman (Fedora and Arch Linux)

# Fedora / RHEL
sudo dnf install lsd -y

# Arch Linux
sudo pacman -S lsd

Method 3: Installing via Cargo

cargo install lsd

Confirm the installation by verifying the binary version:

lsd --version

Configuring Terminal Fonts for Icons

To display file icons properly rather than empty square glyphs, your terminal emulator must use a Nerd Font (such as FiraCode Nerd Font, JetBrainsMono Nerd Font, or Hack Nerd Font). You can install a Nerd Font on Linux via your package manager or by downloading the TTF fonts directly from nerdfonts.com.

Core Usage and Essential Flags

lsd supports all conventional ls flags while introducing powerful new formatting parameters:

Detailed Long Listing with Icons and Permissions

lsd -l

Displays file permissions, ownership, file size, last modification date, and colour-coded icons.

Showing Hidden Files

lsd -la

Displaying Directory Trees

Instead of switching to a separate tree utility, use lsd’s native tree renderer:

# Display a recursive directory tree
lsd --tree

# Limit tree depth to two levels
lsd --tree --depth 2

Sorting Files Intelligently

# Sort by file size (largest first)
lsd -l --sort size

# Sort by modification time (most recent first)
lsd -l --sort time

# Group all directories before files
lsd -l --group-dirs first

Creating Persistent Shell Aliases

To replace the default ls command transparently across your terminal sessions, configure shell aliases in your shell configuration profile:

# Append aliases to ~/.bashrc or ~/.zshrc
cat << 'EOF' >> ~/.bashrc

# lsd Aliases
alias ls='lsd --group-dirs first'
alias l='lsd -l --group-dirs first'
alias la='lsd -la --group-dirs first'
alias lt='lsd --tree --depth 2'
EOF

source ~/.bashrc

Customising Colours and Configuration

lsd looks for an optional configuration file at ~/.config/lsd/config.yaml. You can generate a default configuration template to tailor display preferences:

mkdir -p ~/.config/lsd
cat << 'EOF' > ~/.config/lsd/config.yaml
sorting:
  dir-grouping: first
layout: grid
indicators: true
date: relative
size: short
EOF

Replacing traditional ls with lsd modernises your daily command-line experience, giving you instant visual context and effortless directory navigation across your Linux workflows.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.