Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

An ls replacement written in Rust

LSPlus is a functional Unix ls clone written in Rust. I built it as a Rust learning project, so some code may still show beginner decisions.

lsp output

Compatibility

LSPlus supports Unix-like systems: Linux, macOS, and similar platforms. Windows support is on the roadmap.

Nerd Fonts

Install a Nerd Font in your terminal to display folder and file icons. The Nerd Fonts website has a broad selection.

My personal favourite is MesoLG Nerd Font. Configure your terminal to use the font after installing it.

If you DO NOT want to install a Nerd Font, pass the --no-icons switch to the program.

Installation

Download a Binary

Download the latest Linux or macOS archive from the release page. Unpack it, move lsp into a directory on your PATH, and make it executable if needed.

These binaries are auto-generated for each release.

Using Cargo

If you have rust installed, you can install the latest release of this package, using the following command:

cargo install lsplus

This will install the lsp binary into your ~/.cargo/bin directory. Make sure that this directory is in your PATH environment variable so that you can run the lsp command from anywhere.

From Source

Install the package from the GitHub repository with:

cargo install --git https://github.com/seapagan/lsplus.git

This uses unreleased commits from the default branch.

Usage

Run this command in your terminal to list files in the current directory:

lsp <options> <path | file>

Options and paths are optional. With no path, lsp lists the current directory. With no options, it uses defaults similar to ls.

Currently, only a sub-set of the standard ls options are supported. These are:

  • -a / --all - Show hidden files
  • -A / --almost-all - Show hidden files, but don’t show . and ..
  • -p / --slash-dirs - Append a ‘/’ to directories
  • --file-type - Append type indicators except * for executables
  • -F / --classify - Append type indicators, including * for executables
  • --no-indicators - Disable file type indicators
  • -l / --long - Show long format listing
  • -h / --human-readable - Human readable file sizes using powers of 1024
  • --si - Human readable file sizes using powers of 1000
  • -D / --sort-dirs - Sort directories first
  • -I / --gitignore - Dim entries matched by Git ignore rules
  • -N / --no-color - Disable colored and styled output
  • --no-permission-colors - Disable long-format file type character and permission colors
  • --no-time-gradient - Use the fixed long-format timestamp color
  • --no-size-colors - Disable long-format large-size colors
  • --no-icons - don’t show file or folder icons
  • -V / --version - Print version information and exit
  • -Z / --fuzzy-time - Show fuzzy time for file modification times

You can combine the short options together, e.g. -laph will show a long format listing with hidden files, append a ‘/’ to directories, and show human-readable file sizes.

Use the --help option to see the full list of options.

The indicator characters are:

  • / for directories
  • @ for symlinks
  • | for FIFOs
  • = for sockets
  • * for executables, but only with -F / --classify

In long format, native mode omits the symlink @ marker because name -> target and the symlink styling already make the type clear. This also matches GNU ls, which does not append @ to symlink names in long format.

Styled output is enabled automatically when writing to a terminal. Captured, piped, and redirected output is plain by default. You can also disable styled output explicitly with --no-color, no_color = true in the config file, or the NO_COLOR environment variable.

Long-format output colors permission bits, timestamp freshness, and large file sizes by default. You can adjust those accents independently with --no-permission-colors, --no-time-gradient, --no-size-colors, or the matching permission_colors = false, time_gradient = false, and size_colors = false config options.

Timestamp colors adapt to terminal color capability. Truecolor terminals use a smooth age gradient and 256-color terminals use a stepped fallback to distinguish files newer than a day, week, month, and year. Basic ANSI terminals use named yellow styling. Disabling time_gradient keeps normal timestamps on the original fixed timestamp color. Future-dated timestamps stay red to make clock-skewed files stand out.

When -I is enabled, lsp checks the same ignore sources Git normally uses: merged .gitignore files in the worktree, .git/info/exclude, and the configured global Git excludes file.

Compatibility Mode

lsp has two CLI modes:

  • native - the default lsplus command-line interface
  • gnu - a GNU ls compatibility mode intended for aliases and scripts

You can enable GNU compatibility mode by setting compat_mode = "gnu" in the config file or by setting LSP_COMPAT_MODE=gnu in the environment. The environment variable takes precedence over the config file.

At the moment, gnu mode changes the CLI surface and help output only. It does not yet implement the missing GNU meanings for the conflicting short flags -D, -I, -N, and -Z; those flags are reserved in gnu mode and will error until their GNU behavior is implemented.

The current lsplus features behind those four native short flags are still available in gnu mode through their long forms only:

  • --group-directories-first (replaces the original --sort-dirs)
  • --gitignore
  • --no-color
  • --fuzzy-time

GNU indicator options are also available in gnu mode:

  • -p / --indicator-style=slash
  • --file-type / --indicator-style=file-type
  • -F / --indicator-style=classify
  • --indicator-style=none

Fuzzy Time

The -Z option shows file modification times in a human-readable format, e.g. ‘2 hours ago’, ‘yesterday’, etc.

fuzzy date output

Icons

lsp shows icons for folders, files, and links. The current mappings cover common names and extensions. Open an issue or PR if you want another icon.

Disable icons with the --no-icons option.

Aliases

Add this line to .bashrc, .zshrc, or a similar file to alias ls to lsp:

alias ls='lsp'

If you want that alias to behave more like GNU ls, enable gnu compatibility mode in your config file or set LSP_COMPAT_MODE=gnu in your shell environment.

Restart your shell or source your configuration file to load the alias.

This alias enables several common options:

alias ll='lsp -laph'

This shows a long-format listing with hidden files, appends / to directories, and shows human-readable file sizes.

Set default options in the configuration file.

lsp output

Add -D in native mode, or --group-directories-first in GNU mode, to sort directories first:

lsp output

Configuration File

Configure lsplus with a TOML file at:

  • Linux: ~/.config/lsplus/config.toml
  • macOS: ~/.config/lsplus/config.toml

The configuration file is optional. lsplus uses default settings when the file does not exist.

lsplus also supports an LSP_COMPAT_MODE environment variable. When set, it overrides the compat_mode value from the config file.

Available Options

The configuration file supports these command-line options:

compat_mode

  • Permitted values: "native" or "gnu"
  • Default value: "native"

This option selects which command-line interface lsp uses at startup. native keeps the standard lsplus CLI, while gnu enables the GNU ls compatibility surface intended for aliases and scripts.

At the moment, gnu mode changes the CLI surface and help output only. The conflicting GNU short flags -D, -I, -N, and -Z are reserved in that mode and will error until their GNU behavior is implemented.

show_all

  • Permitted values: true or false
  • Default value: false

This option corresponds to -a or --all and displays hidden files when set to true.

almost_all

  • Permitted values: true or false
  • Default value: false

This option corresponds to -A or --almost-all and displays hidden files except . and .. when set to true.

indicator_style

  • Permitted values: "none", "slash", "file-type", or "classify"
  • Default value: "none"

This option selects which file type indicators lsp appends to entry names. In native mode, the related CLI options are -p / --slash-dirs, --file-type, -F / --classify, and --no-indicators. In gnu compatibility mode, the equivalent GNU forms are -p, --indicator-style=slash, --file-type, --indicator-style=file-type, -F, --indicator-style=classify, and --indicator-style=none.

The indicator characters are / for directories, @ for symlinks, | for FIFOs, = for sockets, and * for executables. The * executable marker is only added by "classify".

In long format, native mode omits the symlink @ marker because name -> target and the symlink styling already make the type clear. This also matches GNU ls, which does not append @ to symlink names in long format.

For backward compatibility, append_slash = true is still accepted in the config file and maps to indicator_style = "slash". If both are present, indicator_style takes precedence.

dirs_first

  • Permitted values: true or false
  • Default value: false

This option corresponds to --sort-dirs and sorts directories before files when set to true. In gnu compatibility mode, the equivalent long option is --group-directories-first (replacing the original --sort-dirs).

long_format

  • Permitted values: true or false
  • Default value: false

This option corresponds to --long and displays output in long format when set to true.

human_readable

  • Permitted values: true or false
  • Default value: false

This option corresponds to -h or --human-readable and displays human-readable file sizes using powers of 1024 when set to true.

si

  • Permitted values: true or false
  • Default value: false

This option corresponds to --si and displays human-readable file sizes using powers of 1000 when set to true. It also enables human-readable size output.

no_icons

  • Permitted values: true or false
  • Default value: false

This option corresponds to --no-icons and hides icons when set to true.

no_color

  • Permitted values: true or false
  • Default value: false

This option corresponds to -N or --no-color and disables colored and styled output when set to true.

permission_colors

  • Permitted values: true or false
  • Default value: true

This option controls long-format colors for the file type character and permission bits. Set it to false, or pass --no-permission-colors, to render those fields without accent colors.

time_gradient

  • Permitted values: true or false
  • Default value: true

This option controls long-format timestamp freshness colors. Set it to false, or pass --no-time-gradient, to use the fixed timestamp color instead of age-based timestamp colors.

Timestamp colors adapt to terminal color capability: truecolor terminals use a smooth age gradient and 256-color terminals use a stepped fallback to distinguish day, week, month, and year bands. Basic ANSI terminals use named yellow styling. Future-dated timestamps stay red, even with time_gradient disabled, to make clock-skewed files stand out.

size_colors

  • Permitted values: true or false
  • Default value: true

This option controls long-format large-size colors. Set it to false, or pass --no-size-colors, to render sizes without large-file accents.

gitignore

  • Permitted values: true or false
  • Default value: false

This option corresponds to -I or --gitignore and dims entries matched by the active Git ignore rules, including merged .gitignore files, .git/info/exclude, and the configured global Git excludes file.

fuzzy_time

  • Permitted values: true or false
  • Default value: false

This option corresponds to -Z or --fuzzy-time and displays timestamps in a fuzzy format when set to true.

Example Configuration File

This example sets several options. Omitted options use default values:

# compat_mode = "native"  # or "gnu" for GNU ls compatibility
show_all = true
indicator_style = "classify"
dirs_first = true
human_readable = true
# si = true
no_color = true
permission_colors = false
time_gradient = false
size_colors = false
fuzzy_time = true
gitignore = true

Future Plans

This page includes the project TODO list.

Open a GitHub issue to suggest another feature or improvement.

TODO

  • add colorization for different file types, folders and symlinks. Make it customizable and theme-able. Make it default but allow an option to disable it (or vice-versa). Files that have a known extension should all be colored the same way, and different to unknown file tipes.
  • Add icons for partials like TODO.*, LICENSE.* and more - brands like claude, codex, vscode and more where the nerdfont exists
  • using the config file, allow extending the existing file and folder mapping, or deleting specific maps.
  • add a -R flag to recursively list files in a directory.
  • When adding recursion or tree-style output, revisit whether directory traversal should move over to the ignore crate instead of the current custom walker.
  • better handle dotfiles?
  • option to list dotfiles (and folders) before non-dotfiles
  • Investigate an optional name-shortening mode for very long filenames that preserves extensions without changing the default wrap behavior.
  • Consider separating config-loaded values from effective runtime params so merge behavior is more explicit than the current shared Params type.
  • Extend human-readable size units beyond petabytes so exabyte-scale values render as E instead of large P multiples.
  • Review src/lib.rs and crate/module visibility. Keep the current out-of-source unit test layout, but reduce the accidental public library API for this app crate where modules/items do not need to be exported.
  • Continue shifting tests toward behavior-focused checks at module seams (app, settings, render) instead of broad smoke-style coverage.