LinuxCommandLibrary

lsd

List directory contents with improved visuals

TLDR

List files and directories, one per line

$ lsd [[-1|--oneline]]
copy

List all files and directories, including hidden ones, in the current directory
$ lsd [[-a|--all]]
copy

List files and directories with trailing / added to directory names
$ lsd [[-F|--classify]]
copy

List all files and directories in long format (permissions, ownership, size in human-readable format, and modification date)
$ lsd [[-lha|--long --human-readable --all]]
copy

List files and directories in long format, sorted by size (descending)
$ lsd [[-lS|--long --sizesort]]
copy

List files and directories in long format, sorted by modification date (oldest first)
$ lsd [[-ltr|--long --timesort --reverse]]
copy

Only list directories
$ lsd [[-d|--directory-only]] [*/]
copy

Recursively list all directories in a tree format
$ lsd --tree [[-d|--directory-only]]
copy

SYNOPSIS

lsd [options] [files...]

This command provides a powerful and customizable way to list directory contents, generally following the ls syntax but extending it with many specific options and visual enhancements.

PARAMETERS

-l, --long
    Use a long listing format, showing permissions, owner, size, date, etc.

-a, --all
    Do not ignore entries starting with '.'.

-A, --almost-all
    Do not list implied '.' and '..'.

-h, --human-readable
    With -l, print sizes in human readable format (e.g., '1K', '234M', '2G').

-t, --sort=time
    Sort by time modified, newest first.

-r, --reverse
    Reverse order while sorting.

-F, --classify
    Append indicator (one of '*/=>@|') to entries.

-R, --recursive
    List subdirectories recursively.

--tree
    Recurse into directories and list them as a tree structure.

--group-dirs {none, first, last}
    Control how directories are grouped in the listing output.

--color {always, auto, never}
    When to use color in the output.

--icons {always, auto, never}
    When to use file type icons in the output (requires Nerd Fonts).

--permissions {rwx, octal}
    Display file permissions in 'rwx' or 'octal' format.

--hyperlink
    Display paths as hyperlinks (requires terminal support).

--header
    Display the header in the long listing format.

DESCRIPTION

lsd (LiSt Directory) is a rewritten version of the standard ls command, but with many added features, colors, and icons. Built in Rust, it aims to provide a more visually appealing and informative output for directory listings.

It supports various view modes, including tree view, detailed view, and compact view. It also integrates Git status information, file permissions, and extended attributes in a user-friendly manner. lsd enhances readability by using distinct colors for different file types, permissions, and ownership, making it easier to parse information at a glance. It’s an excellent choice for users looking to modernize their terminal experience.

CAVEATS

lsd is an external tool and needs to be installed separately, unlike ls which is part of GNU Coreutils on most Linux distributions. Optimal display of icons and colors requires a terminal emulator that supports Nerd Fonts or similar icon fonts.

While highly customizable, configuring lsd requires understanding its specific options, which differ from ls. For extremely large directories or recursive operations, its rich feature set might introduce a slight performance overhead compared to a plain ls.

CONFIGURATION FILES

lsd can be configured using a YAML file, typically located at ~/.config/lsd/config.yaml. This allows for persistent customization of default behaviors, such as default sorting, column display, icon usage, and color schemes, providing a highly personalized listing experience.

NERD FONTS REQUIREMENT

To fully utilize lsd's icon display capabilities, users must install a Nerd Font in their terminal emulator. Without a compatible font, icons may appear as broken characters or simply not display, although the command's other features (colors, formatting) will still function.

HISTORY

lsd was created by Peltoche and first released around 2018. It was developed to address the limitations of the traditional ls command by leveraging modern programming paradigms and Rust's performance capabilities.

Its development was driven by the desire for a more visually appealing and informative command-line experience, incorporating features like extensive coloring, file type icons (requiring Nerd Fonts), and Git integration, which are not present in ls. It quickly gained popularity as a robust and eye-pleasing alternative for developers and power users.

SEE ALSO

ls(1), tree(1), exa(1)

Copied to clipboard