exa - Man Page

a modern replacement for ls

Examples (TL;DR)

Synopsis

exa [options] [files]...

Description

exa is a modern replacement for ls. It uses colours for information by default, helping you distinguish between many types of files, such as whether you are the owner, or in the owning group. It also has extra features not present in the original ls, such as viewing the Git status for a directory, or recursing into directories with a tree view.

Display Options

-1,  --oneline

display one entry per line

-G,  --grid

display entries as a grid (default)

-l,  --long

display extended file metadata as a table

-x,  --across

sort the grid across, rather than downwards

-R,  --recurse

recurse into directories

-T,  --tree

recurse into directories as a tree

-F,  --classify

display type indicator by file names

--color,  --colour=WHEN

when to use terminal colours (always, automatic, never)

--color-scale,  --colour-scale

highlight levels of file sizes distinctly

Filtering and Sorting Options

-a,  --all

show hidden and 'dot' files. Use this twice to also show the . and .. directories.

-d,  --list-dirs

list directories like regular files

-L,  --level=DEPTH

limit the depth of recursion

-r,  --reverse

reverse the sort order

-s,  --sort=SORT_FIELD

which field to sort by. Valid fields are name, Name, extension, Extension, size, modified, changed, accessed, created, inode, type, and none. The modified field has the aliases date, time, and newest, and its reverse order has the aliases age and oldest. Fields starting with a capital letter will sort uppercase before lowercase: 'A' then 'B' then 'a' then 'b'. Fields starting with a lowercase letter will mix them: 'A' then 'a' then 'B' then 'b'.

-I,  --ignore-glob=GLOBS

Glob patterns, pipe-separated, of files to ignore

--git-ignore

ignore files mentioned in '.gitignore'

--group-directories-first

list directories before other files

-D,  --only-dirs

list only directories

Long View Options

These options are available when running with --long (-l):

-b,  --binary

list file sizes with binary prefixes

-B,  --bytes

list file sizes in bytes, without any prefixes

-g,  --group

list each file's group

-h,  --header

add a header row to each column

-H,  --links

list each file's number of hard links

-i,  --inode

list each file's inode number

-m,  --modified

use the modified timestamp field

-S,  --blocks

list each file's number of file system blocks

-t,  --time=WORD

which timestamp field to list (modified, changed, accessed, created)

--time-style=STYLE

how to format timestamps (default, iso, long-iso, full-iso)

-u,  --accessed

use the accessed timestamp field

-U,  --created

use the created timestamp field

-@,  --extended

list each file's extended attributes and sizes

--git

list each file's Git status, if tracked

Examples

To display a list of files, with the largest at the top:

exa --reverse --sort=size

To display a tree of files, three levels deep:

exa --long --tree --level=3

Environment Variables

exa responds to the following environment variables:

Columns

Overrides the width of the terminal, in characters. For example, COLUMNS=80 exa will show a grid view with a maximum width of 80 characters.

This option won't do anything when exa's output doesn't wrap, such as when using the --long view.

Exa_strict

Enables strict mode, which will make exa error when two command-line options are incompatible. Usually, options can override each other going right-to-left on the command line, so that exa can be given aliases: creating an alias exa=exa --sort=ext then running exa --sort=size with that alias will run exa --sort=ext --sort=size, and the sorting specified by the user will override the sorting specified by the alias. In strict mode, the two options will not co-operate, and exa will error.

This option is intended for use with automated scripts and other situations where you want to be certain you're typing in the right command.

Exa_grid_rows

Limits the grid-details view (exa --grid --long) so it's only activated when at least the given number of rows of output would be generated. With widescreen displays, it's possible for the grid to look very wide and sparse, on just one or two lines with none of the columns lining up. By specifying a minimum number of rows, you can only use the view if it's going to be worth using.

LS_COLORS and EXA_COLORS

The EXA_COLORS variable is the traditional way of customising the colours used by ls.

You can use the dircolors program to generate a script that sets the variable from an input file, or if you don't mind editing long strings of text, you can just type it out directly. These variables have the following structure:

  • A list of key-value pairs separated by =, such as *.txt=32.
  • Multiple ANSI formatting codes are separated by ;, such as *.txt=32;1;4.
  • Finally, multiple pairs are separated by :, such as *.txt=32:*.mp3=1;35.

The key half of the pair can either be a two-letter code or a file glob, and anything that's not a valid code will be treated as a glob, including keys that happen to be two letters long.

LS_COLORS can use these ten codes:

  • di, directories
  • ex, executable files
  • fi, regular files
  • pi, named pipes
  • so, sockets
  • bd, block devices
  • cd, character devices
  • ln, symlinks
  • or, symlinks with no target

EXA_COLORS can use many more:

  • ur, the user-read permission bit
  • uw, the user-write permission bit
  • ux, the user-execute permission bit for regular files
  • ue, the user-execute for other file kinds
  • gr, the group-read permission bit
  • gw, the group-write permission bit
  • gx, the group-execute permission bit
  • tr, the others-read permission bit
  • tw, the others-write permission bit
  • tx, the others-execute permission bit
  • su, setuid, setgid, and sticky permission bits for files
  • sf, setuid, setgid, and sticky for other file kinds
  • xa, the extended attribute indicator
  • sn, the numbers of a file's size
  • sb, the units of a file's size
  • df, a device's major ID
  • ds, a device's minor ID
  • uu, a user that's you
  • un, a user that's someone else
  • gu, a group that you belong to
  • gn, a group you aren't a member of
  • lc, a number of hard links
  • lm, a number of hard links for a regular file with at least two
  • ga, a new flag in Git
  • gm, a modified flag in Git
  • gd, a deleted flag in Git
  • gv, a renamed flag in Git
  • gt, a modified metadata flag in Git
  • xx, "punctuation", including many background UI elements
  • da, a file's date
  • in, a file's inode number
  • bl, a file's number of blocks
  • hd, the header row of a table
  • lp, the path of a symlink
  • cc, an escaped character in a filename
  • bO, the overlay style for broken symlink paths

Values in EXA_COLORS override those given in LS_COLORS, so you don't need to re-write an existing LS_COLORS variable with proprietary extensions.

Unlike some versions of ls, the given ANSI values must be valid colour codes: exa won't just print out whichever characters are given. The codes accepted by exa are:

  • 1, for bold
  • 4, for underline
  • 31, for red text
  • 32, for green text
  • 33, for yellow text
  • 34, for blue text
  • 35, for purple text
  • 36, for cyan text
  • 37, for white text
  • 38;5;nnn, for a colour from 0 to 255 (replace the nnn part)

Many terminals will treat bolded text as a different colour, or at least provide the option to.

exa provides its own built-in set of file extension mappings that cover a large range of common file extensions, including documents, archives, media, and temporary files. Any mappings in the environment variables will override this default set: running exa with LS_COLORS="*.zip=32" will turn zip files green but leave the colours of other compressed files alone.

You can also disable this built-in set entirely by including a reset entry at the beginning of EXA_COLORS. So setting EXA_COLORS="reset:*.txt=31" will highlight only text files; setting EXA_COLORS="reset" will highlight nothing.

Examples

  • Disable the "current user" highlighting: EXA_COLORS="uu=0:gu=0"
  • Turn the date column green: EXA_COLORS="da=32"
  • Highlight Vagrantfiles: EXA_COLORS="Vagrantfile=1;4;33"
  • Override the existing zip colour: EXA_COLORS="*.zip=38;5;125"
  • Markdown files a shade of green, log files a shade of grey: EXA_COLORS="*.md=38;5;121:*.log=38;5;248"

Built-in Extensions

  • "Immediate" files are the files you should look at when downloading and building a project for the first time: READMEs, Makefiles, Cargo.toml, and others. They're highlighted in yellow and underlined.
  • Images (png, jpeg, gif) are purple.
  • Videos (mp4, ogv, m2ts) are a slightly purpler purple.
  • Music (mp3, m4a, ogg) is a deeper purple.
  • Lossless music (flac, alac, wav) is deeper than that purple. In general, most media files are some shade of purple.
  • Cryptographic files (asc, enc, p12) are a faint blue.
  • Documents (pdf, doc, dvi) are a less faint blue.
  • Compressed files (zip, tgz, Z) are red.
  • Temporary files (tmp, swp, ~) are grey.
  • Compiled files (class, o, pyc) are faint orange. A file is also counted as compiled if it uses a common extension and is in the same directory as one of its source files: 'styles.css' will count as compiled when next to 'styles.less' or 'styles.sass', and 'scripts.js' when next to 'scripts.ts' or 'scripts.coffee'.

Author

exa is maintained by Benjamin 'ogham' Sago and many other contributors. You can view the full list at <https://github.com/ogham/exa/graphs/contributors>.

Info

2019-07-15 exa 0.9.0