exa

Filtering

You can filter and sort the file list to only display certain entries in a listing.

Ignoring files by glob

exa allows you to provide a list of glob patterns to ignore: if a file’s name matches one of these patterns, then that entry will be excluded from the list.

Glob syntax is fairly simple, making it good enough for most cases.

  • ? matches a character;
  • * matches zero or more characters;

You can supply multiple patterns separated by pipe | characters, and if a file matches any pattern, it will be ignored.

exa
Alphabetize.scpt  Open URL.scpt  Select Line.scpt  Word Count.scpt
Lowercase.scpt    rot13.sh       Uppercase.scpt

exa --ignore-glob="*case*"
Alphabetize.scpt  Open URL.scpt  rot13.sh  Select Line.scpt  Word Count.scpt

exa --ignore-glob="Open*|rot??.sh|*case*"
Alphabetize.scpt  Select Line.scpt  Word Count.scpt

Ignoring invisible and ‘dot’ files

By default, exa will not print any files that start with a dot. Rather than being a flag on the filesystem, there’s a Unix convention that any file beginning with a dot should be hidden from normal views. These are usually configuration or ‘auxiliary’ files that shouldn’t be tampered with by most users.

If you want to show these hidden files, then pass the -a or --all command-line option to exa.

Furthermore, each directory gets created with two directories already present: . which points to the directory itself, and .. to the parent of the directory.

These files are super-hidden: you will need to pass the -a option twice to list them. So exa -a -a will produce a listing with the . and .. entries present.

Note that you can still list . and .. by asking for them specifically.

exa
Library

exa --all
.bash_history  .config  .gem  .local  .viminfo

exa --all --all
.  ..  .bash_history  .config  .gem  .local  .viminfo

exa --no-recurse . ..
.  ..

Sorting

You can pick which order the files are listed in with the --sort option, which takes an argument that specifies the field to sort by:

  • name or filename

    Sorts by the name of the file.

  • size or filesize

    Sorts by size, with the smallest at the top and the largest at the bottom.

  • ext or extension

    Sorts by the filename’s extension.

  • .name or .filename

    Sorts by the name of the file, without a leading dot.

  • mod or modified

    Sorts by the file’s modified date, with the oldest at the top and the newest at the bottom.

  • old or oldest

    A variant of modified that automatically applies --reverse.

  • acc or accessed

    Sorts by the file’s accessed date.

  • cr or created

    Sorts by the file’s ‘created’ or (‘changed’) date.

  • inode

    Sorts by the file’s inode.

  • none

    Doesn’t sort at all.

Furthermore, you can capitalise the name and extension sort fields into Name or Ext if you wish to sort case-insensitively.

Some people prefer to have directories on top, and files underneath. If you’re one of these people, you can use the --group-directories-first command-line option to sort directories before other files.

Finally, you can reverse the sort order with the -r or --reverse command-line options.

exa --sort=ext
compressed.deb     compressed.tgz  compressed.tar.xz
compressed.tar.gz  compressed.txz

Why does exa interpret --all --all differently from ls?

It’s true! Using --all twice in ls means you want to hide the . and .. directories, while using it in exa means you want to show them.

This is because those two directories almost always just take up space. They have their uses, and sometimes you will need them included in directory listings, but you won’t need to see them in every directory listing! So exa made the decision to switch the option around, so the more common case is shorter. It also makes --all adds more files each time you use it.