Documentation

Reference for eka 0.5.9. Run eka --help or man eka for the same information in your terminal.

Quick start

$ eka # list the current directory $ 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 $ eka -d */ # the directories themselves $ eka -F # append / * @ | = indicators $ eka --color=always | less -R

With several paths, files are listed first, then each directory under its own path: heading, as ls does. On a terminal the output is in columns; when piped it is one entry per line.

Options

When options compete for the same setting, the last one wins, as in GNU ls (-S -t sorts by time, -t -S by size; -F -p appends only /). Repeating an option is allowed.

Format

OptionDescription
-1One entry per line (default when output is not a terminal)
-CColumns, sorted down (default on a terminal)
-xColumns, sorted across (rows)
-mComma-separated list, wrapped to the width
-lLong listing format
-n, --numeric-uid-gidLike -l, with numeric user and group IDs
-gLike -l, without the owner
-oLike -l, without the group
-G, --no-groupWith -l, do not print the group
--format=WORDacross/horizontal (-x), commas (-m), long/verbose (-l), single-column (-1), vertical (-C)
-w, --width=COLSOutput width; 0 means no limit. Default: $COLUMNS, then the terminal, then 80
-T, --tabsize=COLSPad columns with tabs every COLS (default 8); 0 pads with spaces only. No tabs with -w 0

Which entries

OptionDescription
-a, --allDo not ignore entries starting with .; also show . and ..
-A, --almost-allLike -a, without . and ..
-d, --directoryList directories themselves, not their contents
-R, --recursiveList subdirectories recursively (symlinked directories are not followed)
-I, --ignore=PATTERNDo not list entries matching the shell PATTERN; repeatable, applies even with -a
--hide=PATTERNLike -I, but -a and -A override it
-B, --ignore-backupsDo not list entries ending with ~
-fDo not sort and list all entries (same as -aU)

Patterns for -I and --hide support *, ?, [abc], [a-z], [!abc] and \ escapes. They match the whole name (a leading dot is not special) and never apply to paths named on the command line.

Sizes, indicators, symlinks

OptionDescription
-h, --human-readableWith -l, sizes as 1.5K, 234M, 2.0G (rounded up)
--siLike -h, with powers of 1000 (1.5k, 234M)
-s, --sizePrint the allocated size of each entry in blocks (1 KiB by default); also prints total
-k, --kibibytesUse 1024-byte blocks (the default)
--block-size=SIZEScale sizes by SIZE: K M G T P E and KiB MiB ... are powers of 1024, KB MB GB ... powers of 1000. A bare unit (K) prints sizes with the suffix (16K); with a number (1K, 2K, 1024) they print without. -h overrides it
-i, --inodePrint the inode number of each entry
-F, --classifyAppend an indicator: / directory, * executable, @ symlink, | fifo, = socket
--file-typeLike -F, without *
-p, --indicator-style=STYLEnone, slash (-p), file-type or classify (-F)
-L, --dereferenceShow information for the file a symlink points to
-H, --dereference-command-lineFollow symlinks named on the command line
-PNever follow symlinks (default); overrides -H and -L

Sorting and time

OptionDescription
-SSort by size, largest first
-tSort by time, newest first
-vNatural sort of version numbers (file2 before file10)
-XSort by extension, then name
-UDo not sort; list in directory order
-r, --reverseReverse the sort order
--sort=WORDname (default), none, size, time, version, extension
--group-directories-firstList directories (and symlinks to directories) first, whatever the sort or -r
-uUse access time. With -lt sort by it and show it; with -l show it and sort by name; otherwise sort by it
-cUse status-change (ctime) time. Same rules as -u
--time=WORDShow and sort by atime (access, use), ctime (status), mtime (modification) or birth (creation; prints ? when the filesystem does not record it)
--time-style=STYLEfull-iso, long-iso, iso, locale or +FORMAT (a strftime format; if it has a newline, the part before is for older files, the part after for recent ones). $TIME_STYLE is the default
--full-timeLike -l --time-style=full-iso

Names and quoting

OptionDescription
-N, --literalPrint names as they are
-b, --escapeC-style backslash escapes for unusual characters
-Q, --quote-nameEnclose names in double quotes, with C escapes
-q, --hide-control-charsPrint ? instead of unprintable characters
--show-control-charsPrint unprintable characters as they are (default when output is not a terminal)
--quoting-style=WORDliteral, shell, shell-always, shell-escape, shell-escape-always, c or escape

Other

OptionDescription
--color[=WHEN]always, auto (default) or never; plain --color means always
--completions=SHELLPrint the completion script for bash, zsh, fish, elvish or powershell and exit
--helpPrint help
-V, --versionPrint the version

Sorting

  • In the C locale (LC_ALL=C) names sort bytewise.
  • In any other locale (LC_ALL, LC_COLLATE or LANG, in that order) names sort ignoring case and accents, with punctuation before digits before letters, as GNU ls does in a UTF-8 locale. macOS and glibc (Linux) each have their own model.
  • Ties in size and time fall back to the name.
  • Directories are not grouped first unless you pass --group-directories-first.
Tip. For scripts that need a stable, locale-independent order, run LC_ALL=C eka.

Safe output

File names are arbitrary bytes. A name like evil\x1b[2J or report‮txt.exe can clear the screen, change the window title or disguise a file type when printed raw. Eka follows GNU ls:

  • On a terminal the default quoting style is shell-escape: a name the shell would need quoted is wrapped in single quotes and unprintable characters appear as $'\033'-style escapes, so every name can be pasted back into a shell.
  • When piped or redirected names are written as they are, because the output is data for another program. Use -b, -Q, -q, --quoting-style or QUOTING_STYLE to escape them anyway.
  • A newline in a name is always shown as ? when names are printed as they are (-N, literal, shell).
  • Unprintable means control characters (C0, DEL, C1), bidirectional overrides and isolates, line and paragraph separators, and bytes that are not valid UTF-8.
  • Link targets, path: headings and error messages are quoted the same way.
  • -R cannot loop: a directory that is its own ancestor (possible with -L) is reported as not listing already-listed directory and skipped.
  • No unsafe code (#![forbid(unsafe_code)]). Unrepresentable timestamps print ?.

Color

Colors are used only when standard output is a terminal, unless --color says otherwise. With --color=auto, a non-empty NO_COLOR and TERM=dumb turn color off; --color=always ignores them.

If LS_COLORS is set, eka uses it (keys di ln ex or pi so bd cd fi and *.ext patterns) on top of the GNU defaults. Otherwise it uses its own palette:

File typeColor
DirectoryCyan
ExecutableGreen
Symlink, fifoYellow
Broken symlinkBold red
Socket, imageMagenta
Block / character deviceBold yellow
VideoRed
AudioOrange
ArchiveBlue
Regular fileDefault

Environment variables

VariableEffect
LC_ALL, LC_COLLATE, LANGSort order (checked in that order). C sorts bytewise
LS_COLORSColors by file type and extension
NO_COLORWhen set and not empty, disables color with --color=auto
TERMdumb disables color with --color=auto
QUOTING_STYLEDefault quoting style, same values as --quoting-style
TIME_STYLEDefault for --time-style
COLUMNSOutput width when -w is not given
EKA_TEST_LSDevelopment only: the reference ls for cargo test --test compat_ls

Exit status

CodeMeaning
0Success
1Minor problem, such as an unreadable entry inside a listed directory
2Serious problem, such as a path on the command line that cannot be accessed

Shell completions and man page

Homebrew installs the man page and completions for you. Otherwise, eka --completions SHELL prints the script for bash, zsh, fish, elvish or powershell.

$ # bash: add to ~/.bashrc $ source <(eka --completions bash) $ # zsh: put the script in a directory of $fpath, then run compinit $ eka --completions zsh > "${fpath[1]}/_eka" $ # fish $ eka --completions fish > ~/.config/fish/completions/eka.fish

From a source checkout, ./install-manpage.sh installs the man page.

Replacing ls

Try it first as an alias; nothing else on your system changes:

$ alias ls=eka # add to ~/.bashrc or ~/.zshrc $ alias ll='eka -lh'

Aliases apply only to interactive shells, so scripts keep using the system ls. Eka is not yet 1.0 and a few GNU options are missing (see below), so leave scripts alone until you have checked what they use.

Known differences from GNU ls

  • Not implemented yet: --author, -D, -Z.
  • Sort order: eka approximates GNU collation. It matches GNU ls on Latin-script names, ASCII punctuation, digits and accented Latin-1 letters. On Linux it follows glibc; in a 900-name random-symbol test, 3 pairs differing only in punctuation and accents or case sort differently. Other scripts and language rules (Spanish ch, German ß) sort by code point.
  • Newlines in names: with --quoting-style=literal or shell (and -N) eka prints ?. GNU coreutils 9.4 prints it raw; newer versions print ?.
  • Column fit: eka lets columns fill the width exactly (total <= width), like recent coreutils. Ubuntu's 9.4 needs total < width.
  • Quoting: shell styles always use single quotes ('it'\''s'); GNU uses double quotes for a name with an apostrophe. locale and clocale styles are not implemented. With --quoting-style=shell, a name whose only special character is a control character is quoted by eka and left bare by GNU.
  • Bidi overrides (such as U+202E) are always unprintable. GNU decides by locale.
  • Wide characters: column widths count code points, so CJK is not measured correctly.
  • total counts 1 KiB blocks, as GNU does; BSD/macOS ls counts 512-byte blocks.
  • Attribute markers: on macOS -l prints @ for extended attributes but not + for ACLs. On Linux it prints + (POSIX ACL) and . (SELinux). The column appears only when some file has a marker.
  • -U/-f: eka puts . and .. first rather than where readdir returns them.

Found another difference? Open an issue with the command and both outputs.

Platforms and requirements

  • macOS and Linux, x86-64 and ARM64. Windows is not supported.
  • Building from source needs Rust 1.88 or later (edition 2024).
  • Release archives carry a build-provenance attestation: gh attestation verify FILE --repo alexlm78/eka.