Published February 15, 2021
Updated February 15, 2021
Shell Exa
Demonstrates using the Exa program for listing files and directories.
Transcript
# Hello and welcome to the Alchemists Screencasts!
# Today, we'll look at using Exa (https://the.exa.website).
# Exa is a powerful enhancement to native `ls` functionality.
# Due to being implemented in Rust (https://www.rust-lang.org), it's fast too.
# For those on macOS, you can install via Homebrew (https://brew.sh):
brew install exa
# For comparison, here is native `ls` versus `exa` functionality:
ls
exa
# At first glance, the difference is subtle but you can see Exa is more concise.
# We can expand upon the above by comparing/contrasting a list view:
ls -alhT
exa --all --long
# Colorization is an immediate visible differentiator over `ls`.
# The succinctness of output -- without losing detail -- is another bonus.
# Here's what I like to use:
exa --all \
--long \
--header \
--group \
--group-directories-first \
--time-style long-iso \
--git \
--git-ignore
# That's a lot to type so I have the above aliased:
cype x
# Now we only need to type `x` for the same result 🎉:
x
# Here's the breakdown of options used:
# `--all` - Show hidden and dot files.
# `--long` - Displays file metadata as a table.
# `--header` - Adds column headers.
# `--group` - Shows file's group.
# `--group-directories-first` - Lists directories before other files.
# `--time-style long-iso` - Uses long ISO date/time stamps.
# `--git` - Shows Git status for file.
# `--git-ignore` - Ignores files listed `.gitignore`.
# Use of `--git` needs more illustration, so I'll make some file changes:
printf "%s\n" "This is a test." > README.md
printf "%s\n" "This is a test." > LICENSE.md
git add LICENSE.md
touch test.txt
x
# First, notice `N` (new) next to `text.txt` since the file is new to Git.
# Second, notice `-M` (modified) next to `README.md` since the file is modified.
# Third, notice `M-` (staged) next to `LICENSE.md` since the file is staged.
# For further Git details, see: https://the.exa.website/features/git.
# Much like `ls`, Exa supports a one line view too:
ls -A1
exa --oneline --all --group-directories-first
# I like to alias the above as `x1`:
cype x1
# Finally, Exa has native tree support which I quite enjoy:
exa --tree
# I like to use the `xt` for this:
cype xt
# During this screencast, you might have noticed I use custom colors.
# To configure colors, Exa supports global constants which I define in `$HOME/.bashrc`:
export EXA_COLORS="da=1;34:di=32:gm=33:gd=31"
# For details on Exa's color keys and values, see: https://the.exa.website/docs/colour-themes.
# Finally, I recommend strict mode to prevent incompatible command line options:
export EXA_STRICT=true
# For more Exa features, see: https://the.exa.website/features.
# You can also study my Dotfiles project: https://alchemists.io/projects/dotfiles.
# Enjoy!
# https://alchemists.io
# ☿ 🜔 🜍 🜂 🜃 🜁 🜄