The ls you already know, rebuilt in Rust.

Eka is a drop-in replacement for GNU/POSIX ls. Same flags, same output, with color on by default, safe handling of hostile file names, and speed on large directories.

v0.5.9 macOS + Linux MIT no unsafe code
$ eka -lh --group-directories-first
drwxr-xr-x  5 alex staff  160B Oct 26 18:52 docs
drwxr-xr-x 12 alex staff  384B Oct 26 18:50 src
drwxr-xr-x  8 alex staff  256B Oct 26 18:44 tests
-rw-r--r--  1 alex staff  1.2K Oct 26 18:53 Cargo.toml
-rw-r--r--  1 alex staff  1.1K Oct 24 20:03 LICENSE
-rw-r--r--  1 alex staff   17K Oct 26 18:54 README.md
lrwxr-xr-x  1 alex staff     9B Oct 20 09:12 latest -> target/eka
$ eka --quoting-style=shell-escape
docs  src  tests  Cargo.toml  LICENSE  README.md  'evil'$'\033''[2J'

Install

Both packages install the eka command. The crate is named eka-ls because eka is taken on crates.io.

Homebrew macOS · Linux

$ brew install alexlm78/tap/eka-ls

That one line adds the tap and installs. Or run brew tap alexlm78/tap first, then brew install eka-ls. Installs the binary, man page and completions for bash, zsh and fish.

Cargo needs Rust 1.88+

$ cargo install eka-ls

Builds from crates.io and puts eka in ~/.cargo/bin. Make sure that directory is in your PATH.

Other ways: release binary, from source, completions

Release binary. Download the archive for your system (macOS and Linux, x86-64 and ARM64) from the releases page, check it against SHA256SUMS, and verify provenance with gh attestation verify FILE --repo alexlm78/eka.

From source.

$ git clone https://github.com/alexlm78/eka.git && cd eka $ cargo install --path .

Shell completions. eka --completions SHELL prints the script for bash, zsh, fish, elvish or powershell.

$ source <(eka --completions bash)

Use it as ls. Add alias ls=eka to your shell config.

Why eka

A replacement should not surprise you. Eka matches ls first, then improves on it.

GNU-compatible

Dozens of flags and options: -1 -C -x -m -l -a -A -R -S -t -v -X -h --time-style --quoting-style and more. The last option wins, as in GNU ls.

Safe output

On a terminal, escape sequences and bidirectional overrides in file names are quoted, so a hostile name cannot clear your screen or disguise .exe as .txt.

Fast

One directory pass, one locked buffered write. It calls stat only when the output needs it. eka | head exits quietly.

Color by default

Automatic on terminals. Honors NO_COLOR and LS_COLORS, with a sensible palette when unset.

Faithful file model

Symlinks are not followed unless asked. Broken links, fifos, sockets, devices and setuid/setgid/sticky bits show correctly.

Memory-safe Rust

#![forbid(unsafe_code)]. -R cannot loop on cyclic directories. Bad timestamps print ? instead of aborting.

Usage

If you know ls, you know eka.

$ eka                  # list the current directory
$ eka -l               # long format
$ eka -lh              # long format, human-readable sizes
$ eka -la              # include hidden files, plus . and ..
$ eka -lSr             # smallest files first
$ eka -lt              # newest first
$ eka -R src/          # recurse into subdirectories
$ eka -d */            # list the directories themselves
$ eka -F               # append / * @ | = indicators
$ eka --color=always | less -R

Full option table in the documentation, or run eka --help and man eka.

Performance

Measured with scripts/bench.sh (hyperfine, 15 runs) on an Apple M-series Mac, APFS, 20,000 files per fixture. Your numbers will differ.

CaseekaGNU lsBSD lseza
-1, 20,000 files22 ms 15 MB67 ms 8 MB88 ms 4 MB137 ms 48 MB
-l, 20,000 files85 ms 22 MB133 ms 9 MB214 ms 10 MB497 ms 101 MB
-R, 2,200 dirs74 ms 14 MB74 ms 2 MB228 ms 1 MB202 ms 8 MB
start-up, 30 files4.5 ms 6 MB3.2 ms 2 MB2.3 ms 1 MB8.7 ms 7 MB

Honest trade-offs: eka is faster on large flat listings and ties GNU ls on recursion, but it uses more memory (it holds a directory's entries before sorting) and starts a couple of milliseconds slower than the C implementations.

Roadmap

Eka is pre-1.0. The goal: the same options, output and exit status as GNU ls on macOS and Linux. Full detail in ROADMAP.md.

Done

Core compatibility

Every common option, last-option-wins semantics, locale-aware sorting, LS_COLORS, safe output, man page, completions, release archives with provenance attestations, crates.io and Homebrew.

In progress

Phase 0 · Stabilize

Name order on Linux (glibc model reaching ~99% agreement on a hostile 900-name corpus), Linux-only paths in CI, -U/-f edge cases.

Phase 2 · Fidelity with GNU ls

LSCOLORS/CLICOLOR, locale and clocale quoting, --author --zero --hyperlink, wide (CJK) character widths, timestamp edge cases.

Phase 3 · Platform parity

-Z / --context with SELinux on Linux.

Phase 4 · Robustness

Nightly differential tests against GNU ls on random trees, error-message parity, 100k-file benchmarks, property tests for quoting.

Phase 5 · Distribution & docs

Static musl build, .deb / .rpm packages, AUR PKGBUILD, architecture docs and a migration guide.

1.0.0

Every known difference from GNU ls fixed or listed as intentional, a clean nightly differential job for several weeks, green CI, a stable command line.

Contribute

Contributions are welcome: bug reports, GNU ls differences you find, tests, docs, packaging.

  1. Get the code

    $ git clone https://github.com/alexlm78/eka.git && cd eka
  2. Build and test

    $ cargo build $ cargo test $ cargo clippy --all-targets

    Needs Rust 1.88 or later (edition 2024).

  3. Compare against GNU ls

    The BSD ls on macOS lacks many GNU options. Point the tests at GNU coreutils:

    $ EKA_TEST_LS=/opt/homebrew/bin/gls cargo test --test compat_ls
  4. Open a pull request

    CI runs Linux (GNU ls) and macOS, a dependency audit and a minimum-Rust-version build.

Project rules

  • Every change bumps the version to the next odd patch (0.5.9, 0.5.11, ...) and adds a CHANGELOG.md entry. scripts/check-version.sh enforces it.
  • Changed a CLI option? Run scripts/gen-completions.sh; cargo test fails if completions are stale.
  • No unsafe. The crate forbids it.
  • Three test layers: unit tests next to the code, end-to-end tests in tests/behavior.rs, and comparisons with the system ls in tests/compat_ls.rs.

Where to start

Full guidelines: CONTRIBUTING.md.

Open an issue Pull requests