Documentation
Reference for eka 0.5.9. Run eka --help or man eka for the same information in your terminal.
Quick start
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
| Option | Description |
|---|---|
-1 | One entry per line (default when output is not a terminal) |
-C | Columns, sorted down (default on a terminal) |
-x | Columns, sorted across (rows) |
-m | Comma-separated list, wrapped to the width |
-l | Long listing format |
-n, --numeric-uid-gid | Like -l, with numeric user and group IDs |
-g | Like -l, without the owner |
-o | Like -l, without the group |
-G, --no-group | With -l, do not print the group |
--format=WORD | across/horizontal (-x), commas (-m), long/verbose (-l), single-column (-1), vertical (-C) |
-w, --width=COLS | Output width; 0 means no limit. Default: $COLUMNS, then the terminal, then 80 |
-T, --tabsize=COLS | Pad columns with tabs every COLS (default 8); 0 pads with spaces only. No tabs with -w 0 |
Which entries
| Option | Description |
|---|---|
-a, --all | Do not ignore entries starting with .; also show . and .. |
-A, --almost-all | Like -a, without . and .. |
-d, --directory | List directories themselves, not their contents |
-R, --recursive | List subdirectories recursively (symlinked directories are not followed) |
-I, --ignore=PATTERN | Do not list entries matching the shell PATTERN; repeatable, applies even with -a |
--hide=PATTERN | Like -I, but -a and -A override it |
-B, --ignore-backups | Do not list entries ending with ~ |
-f | Do 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
| Option | Description |
|---|---|
-h, --human-readable | With -l, sizes as 1.5K, 234M, 2.0G (rounded up) |
--si | Like -h, with powers of 1000 (1.5k, 234M) |
-s, --size | Print the allocated size of each entry in blocks (1 KiB by default); also prints total |
-k, --kibibytes | Use 1024-byte blocks (the default) |
--block-size=SIZE | Scale 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, --inode | Print the inode number of each entry |
-F, --classify | Append an indicator: / directory, * executable, @ symlink, | fifo, = socket |
--file-type | Like -F, without * |
-p, --indicator-style=STYLE | none, slash (-p), file-type or classify (-F) |
-L, --dereference | Show information for the file a symlink points to |
-H, --dereference-command-line | Follow symlinks named on the command line |
-P | Never follow symlinks (default); overrides -H and -L |
Sorting and time
| Option | Description |
|---|---|
-S | Sort by size, largest first |
-t | Sort by time, newest first |
-v | Natural sort of version numbers (file2 before file10) |
-X | Sort by extension, then name |
-U | Do not sort; list in directory order |
-r, --reverse | Reverse the sort order |
--sort=WORD | name (default), none, size, time, version, extension |
--group-directories-first | List directories (and symlinks to directories) first, whatever the sort or -r |
-u | Use access time. With -lt sort by it and show it; with -l show it and sort by name; otherwise sort by it |
-c | Use status-change (ctime) time. Same rules as -u |
--time=WORD | Show and sort by atime (access, use), ctime (status), mtime (modification) or birth (creation; prints ? when the filesystem does not record it) |
--time-style=STYLE | full-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-time | Like -l --time-style=full-iso |
Names and quoting
| Option | Description |
|---|---|
-N, --literal | Print names as they are |
-b, --escape | C-style backslash escapes for unusual characters |
-Q, --quote-name | Enclose names in double quotes, with C escapes |
-q, --hide-control-chars | Print ? instead of unprintable characters |
--show-control-chars | Print unprintable characters as they are (default when output is not a terminal) |
--quoting-style=WORD | literal, shell, shell-always, shell-escape, shell-escape-always, c or escape |
Other
| Option | Description |
|---|---|
--color[=WHEN] | always, auto (default) or never; plain --color means always |
--completions=SHELL | Print the completion script for bash, zsh, fish, elvish or powershell and exit |
--help | Print help |
-V, --version | Print the version |
Sorting
- In the
Clocale (LC_ALL=C) names sort bytewise. - In any other locale (
LC_ALL,LC_COLLATEorLANG, in that order) names sort ignoring case and accents, with punctuation before digits before letters, as GNUlsdoes 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.
LC_ALL=C eka.Safe output
File names are arbitrary bytes. A name like evil\x1b[2J or reporttxt.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-styleorQUOTING_STYLEto 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. -Rcannot loop: a directory that is its own ancestor (possible with-L) is reported asnot listing already-listed directoryand skipped.- No
unsafecode (#![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 type | Color |
|---|---|
| Directory | Cyan |
| Executable | Green |
| Symlink, fifo | Yellow |
| Broken symlink | Bold red |
| Socket, image | Magenta |
| Block / character device | Bold yellow |
| Video | Red |
| Audio | Orange |
| Archive | Blue |
| Regular file | Default |
Environment variables
| Variable | Effect |
|---|---|
LC_ALL, LC_COLLATE, LANG | Sort order (checked in that order). C sorts bytewise |
LS_COLORS | Colors by file type and extension |
NO_COLOR | When set and not empty, disables color with --color=auto |
TERM | dumb disables color with --color=auto |
QUOTING_STYLE | Default quoting style, same values as --quoting-style |
TIME_STYLE | Default for --time-style |
COLUMNS | Output width when -w is not given |
EKA_TEST_LS | Development only: the reference ls for cargo test --test compat_ls |
Exit status
| Code | Meaning |
|---|---|
0 | Success |
1 | Minor problem, such as an unreadable entry inside a listed directory |
2 | Serious 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.
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:
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
lson 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 (Spanishch, Germanß) sort by code point. - Newlines in names: with
--quoting-style=literalorshell(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 needstotal < width. - Quoting: shell styles always use single quotes (
'it'\''s'); GNU uses double quotes for a name with an apostrophe.localeandclocalestyles 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.
totalcounts 1 KiB blocks, as GNU does; BSD/macOSlscounts 512-byte blocks.- Attribute markers: on macOS
-lprints@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 wherereaddirreturns 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.