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
--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.
exa -a -a will produce a listing with the
.. entries present.
Note that you can still list
.. 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 . .. . ..
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:
Sorts by the name of the file.
Sorts by size, with the smallest at the top and the largest at the bottom.
Sorts by the filename’s extension.
Sorts by the name of the file, without a leading dot.
Sorts by the file’s modified date, with the oldest at the top and the newest at the bottom.
A variant of
modifiedthat automatically applies
Sorts by the file’s accessed date.
Sorts by the file’s ‘created’ or (‘changed’) date.
Sorts by the file’s inode.
Doesn’t sort at all.
Furthermore, you can capitalise the name and extension sort fields into
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
--reverse command-line options.
exa --sort=ext compressed.deb compressed.tgz compressed.tar.xz compressed.tar.gz compressed.txz
Why does exa interpret
--all differently from
It’s true! Using
--all twice in
ls means you want to hide the
.. 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.