Exa: An alternative to Ls
the.exa.website
the.exa.website
I don't spend any time squinting... And personally the bright colors shown in the example are harder on my eyes than the shades of gray I've selected in my terminal emulator.
I also work with a large number of systems, and prefer to work from muscle memory with the tooling that is installed by default 100% of the time.
Part of me wishes projects like this would just write patches for the thing they are trying to replace. There is no reason ls couldn't output emoji file types, just patch it in ls and make it a flag people can alias, like --color=auto.
To each their own I guess.
It's not like the patch would be installed 100% of the time anyway, and shell aliases can paper over divergent installations. So, it's 100% fine if none of these features matter to you - to each his own indeed - but I thought your point deserved a reply.
(EDIT: also, `lc` is < 1000 lines of pretty tabular Nim code; Nim is a very high productivity language; exa and GNU ls are both effectively like 10x more code, IIRC. But yeah, you do need to have the Nim compiler installed)
So far I've used ripgrep, fd-find, sd, exa, bat. I care less about speed and more about ease-of-use and beautiful output. Another bonus is standardized tooling between Mac and Linux; little bsd differences have been driving me nuts since I took a job that forced me into a MacBook, but these tools solve that issue and are easy to install with Homebrew.
I'm in the same boat as you - I love the the rust-based CLI tools. I would also recommend installing the GNU coreutils via homebrew (https://formulae.brew.sh/formula/coreutils). This lets you run the GNU coreutils by prefixing them with a `g`, like `gsed` rather than `sed`.
It was one of the flags for ‘ls’ in particular that made me switch. There’s a way to add the gnu coreutils to your path without the g prefix so I never even notice the difference.
This is why I just use a modern cross platform shell that has everything built in. My choice is PowerShell since I flip between Linux and Windows, Nushell is also a solid choice if you want something more Unixy.
But the thing is, if you install any modern system (ubuntu or fedora or pretty much anything else) and type "ls", it does those two things as well! Your default config will alias ls to enable color by default, and this ls invocation will be doing stat on every page.
So anyone who knows "ls" even a bit would, on looking on that particular page, say, "Huh? That's your special feature? my ls does this already and I don't have to do anything to install it. [close window]"
To reiterate, EXA does have features that "ls" does not. It just that https://the.exa.website/introduction page does not list those features at all. If you want to convince people to switch to EXA, you better point them to a different page.
(available packaged in most linux/bsd distributions)
Imagine if programming languages worked that way.
Good interface design is stable, even as the backend tech improves. Both a go-kart and the NASA crawler-transporter have steering wheels, because the wheel is an affordance for the human, not the machine. But on a Unix system, there's huge churn in how to do things - usually for no better reason than that it would break a bunch of stuff to change how the old way works, so better to simply add a new way. Someone wrote an improved version of grep - does that mean we get grep v2? Nope, we get "ripgrep", and old grep stays permanently...
The worst of it is, that namespace doesn't even guarantee anything! It would at least be some consolation if 'ls' worked identically on every system, but alas...
No reason to tie it to Unix either, other than it being ubiquitous.
et() { exa -alT --git -I'.git|node_modules|.mypy_cache|.pytest_cache|.venv' --color=always "$@" | less -R; }
alias et1='et -L1'
alias et2='et -L2'
alias et3='et -L3'
Exa is great for this because it shows file details along with the tree hierarchy.(I have to manually specify a bunch of git-ignores because Exa's git ignore support doesn't work properly.)
Maybe not as great as exa but not bad for the classic option.
et() { exa -alT --git -I'.git|node_modules|.mypy_cache|.pytest_cache|.venv' --color=always "-L${1:-1}" | less -R }
commands would now be, e.g. "et 2" instead of "et2", but will work with any number. defaults to 1 if just "et" is run with no argument.
I realized that my function above doesn't fully show how I use it. I recommend setting your $LESS to include -F so that by default it doesn't leave pages of output in your scrollback. That way you can get a quick tree, scrollable/searchable in your pager, and then don't lose your shell context. FWIW, my $LESS is:
export LESS='-iMFx4 --mouse' # smart-case, status bar, quit 1 screen, 4sp tabs
Also should mention https://github.com/Canop/broot as a good directory explorer tool. tree: aliased to echo '2\n3\n4\n5' | fzf --preview='exa -l -T -L {} --git-ignore' --reverse --preview-window down:99% --bind 'j:down,k:up,q:cancel,enter:cancel'I use `exa` instead of `ls` on Linux - https://news.ycombinator.com/item?id=26559334 - March 2021 (51 comments)
Exa – A Modern Replacement for Ls - https://news.ycombinator.com/item?id=20564000 - July 2019 (6 comments)
Exa – A Modern Replacement for Ls - https://news.ycombinator.com/item?id=19342031 - March 2019 (1 comment)
Exa – a modern replacement for ls - https://news.ycombinator.com/item?id=18658211 - Dec 2018 (2 comments)
Exa, a modern replacement for ls - https://news.ycombinator.com/item?id=14923362 - Aug 2017 (403 comments)
Show HN: Exa, a replacement for ls written in Rust - https://news.ycombinator.com/item?id=9087108 - Feb 2015 (87 comments)
> Here’s an example. exa, by default, runs the stat system call on every file it encounters.
So does "ls" ... for at least last 20 years. Just checked on random Ubuntu system I had -- executables and dirs are highlighted with different colors.
> exa makes heavy use of colours, treating them as opt-out rather than opt-in: it will highlight files and data differently based on their type or meaning.
So does ls -- I see colors in default install. Yes, you need an environment variable to enable this, but all the modern distros set this anyway.
So based on that page, it seems that the only thing that EXA does differently is that it upgrades ls's 16 color palette to 256 colors.
I think they need stronger motivation.
I'm still not entirely convinced that it's a must-have, but it's more than just ls with fancy colours.
Personally, I'd much rather have seen an output format like JSON as a feature instead, so you can do some easier scripting through exa and jq. I'm sure there are other tools out there to serve thst purpose, though.
I've been using `exa` for over a year now, and I use it as an alias for both `ls` and `tree`. I don't really notice any benefit compared to using `ls`, but I really prefer its tree mode over the default `tree` command. It's nice being able to use the same CLI args and have a similar output format for both `tree` and `ls`.
One minor thing that bugs me about ls however, is the date display. I'd like iso 8601 for old dates, with a human-readable date for recent changes. Currently I have this:
-rw-rw-r-- 1 foo foo 37 2016-03-28 9:14 .Xmodmap
-rw------- 1 foo foo 496k Wed Oct 27 14:27 .xsession-errors
Via `ls --time-style=`, but the cutoff between the two styles is hard-coded to something like six months. I'd prefer a week or so, but not an option. I asked on the mailing list but no action. Can exa or another tool be configured to use two date formats with a week in the past cutoff?This won't ever replace `ls` because it's not POSIX compliant, but that's okay because I don't think it needs to be. I have run into cases where downstream packages have dependencies on non-POSIX commands which gets a little annoying, but you can always choose something else (or take it on yourself to re-implement their idea in a POSIX-compliant way), which is the whole point of open source software.
Let this creator have their fun!
exa is already several years old and has 15 K thousands stars on Github. Not to mention all the people using it that never bothered to give it a star.
I tend to look for things using reverse sorting a lot, and exa -ltra exa -lSr don't work out of the box (not sure why I thought it might, maybe because exa -la did) - And now I'm faced with reading a man page or documentation for some 15-20 seconds which I can't be bothered to do, despite that seeming so simple :)
I do think I'll try to give it a shot, it looks quite nice.
Each of these is a package of files in a directory.
In the last few days I've been developing "ls-like" functionality for these cards with the specific goal of listing cards that need maintenance. For instance I did a series of photographs where I printed the cards but didn't generate the web sites.
Architecturally it's interesting, particularly in that there is the selection logic, the way you display a card, and then the realization that you ought to be able to do something to a card other than display metadata for it but select the cards with the same facility you use to select them for "ls".
High load average, full swap, memory leaks, those things still happen today.
> exa, by default, runs the stat system call on every file it encounters.
99% of ls's use case are: show me the files in this folder.
What happened to KISS (Keep It Simple, Stupid) and the UNIX philosophy (do only one thing, but do it well)?
> 256-colour terminals are everywhere.
Laughs with Windows Terminal.
> ls is still there if you need it.
Thank you, I will keep using it. Also "ls" for "list" is straightforward, what does "exa" even mean?
There is a reason why those programs have not changed in the last 50 years: they work, they do one thing, they do it well, nobody ask them to do more.
The new windows terminal has truecolor.
Examine
The UNIX philosophy isn't "only call one syscall", so getting more info on the files it's displaying is far game in my book.
and that looks like a recent change, as in 2012 someone complained that ls didn't distinguish those at all: https://utcc.utoronto.ca/~cks/space/blog/linux/LsShowCapabil...
so i had an executable that was behaving unexpectedly, somewhat similar to the linked write-up, which ls showed with black text on red background. for a while, until i remembered about capabilities, i couldn't figure out what the unusual colour meant. eventually i found the word 'capability' buried in https://www.gnu.org/software/coreutils/manual/html_node/Gene...
compared to that, exa seems to be a bit more obvious with its '@' indicator (it would be nice if it was documented in the man page and not just in https://the.exa.website/features/long-view) and the -@ option to print xattr/capability names.
Never used a multi-user system with a moderate amount of files, did you? Let alone distributed filesystems.
[1]: https://www.gnu.org/software/coreutils/manual/html_node/dirc...
$ ll
drwxrwxr-x - dan 27 Oct 15:12 -I .idea
.rw-rw-r-- 15 dan 9 Sep 11:44 -N .tool-versions
drwxrwxr-x - dan 9 Sep 11:53 -I dist
drwxrwxr-x - dan 23 Sep 18:53 -- docs
.rw-rw-r-- 376 dan 29 Jun 12:26 -I some-project.iml
drwxr-xr-x - dan 10 Sep 12:28 -I node_modules
.rw-rw-r-- 301 dan 21 Oct 13:17 -N override.env
edit: if it wasn't clear, the above output is a subset of the real output.This is often my biggest annoyance with command line tools that rely on dedicate fonts and private use icons. The functionality is great, but making sure you've got the right fonts installed on every machine/terminal is sometimes tedious enough that I give up on things like exa.
These days I think exa does not show icons by default, which is I think the right decision.
c-blake/lc: A post-modern, "multi-dimensional", configurable, abbreviating, extensible ls/file lister in Nim
It has kind of a long history. I first did a prototype in Python about year 2000 and then a year later a re-write in C which I used for a couple of decades and then an I think pretty nice 3rd gen in Nim. (Often one doesn't really get it all layered correctly until 3rd try, even for something kinda simple like `ls`.)
Miller columns a la NeXTStep is something easy to simulate with `lc` via the glob abbreviation { paste <(lc -1m25 ../..) <(lc -1m25 ..) <(lc -1m25 .) | column } and in general the program is more like an "ls construction toolkit" than a fixed classifier/turnkey ls. But really the readme covers many more details.
Among unusual ones is "tweak" files; Got a directory that you want special defaults for? Just drop in a `.lc` file. (With some parallel hierarchy features when perms do not allow that directly.) This is sort of like Windows remembering what sorting/layout options you clicked on, but manual and opt-in (and far more general).
On the other hand, it could not replace ls for me, because exa does not have any equivalent of the ls option --full-time. All the possible exa options to display the time truncate the timestamps to various resolutions (much coarser than how the timestamps are stored in the file system).
`ls --full-time" gives the timestamps as they are stored by the file system, without alteration. For example the xfs timestamps and the FreeBSD ufs timestamps have nanosecond resolution.
Unless it's different on xfs/ufs, this seems to be nanosecond resolution to me,
full-iso specifies the timestamp down to the millisecond,
including its offset down to the minute, without using the
locale or current year.
If this is information is obsolete, they should update their documentation, because wrong information like this discourages adoption.I never liked the graphical tree mode, though. I prefer packing as much information as possible into small real estate (like cell phone terminal screens).
https://github.com/c-blake/procs does include some "indentation" oriented tree viewing, though, and uses much of the same kind of classification-colorization as `lc`, just for process table listings (on Linux only for now). It also has "user tweakable aggregation" (kind of the reverse of listing the sub-threads in process).
alias ls='ls -vF'
This way you'll see directories and executables in a glance.No need for colors, or fancy ls replacements.
Also, you have --group-directories-first in GNU ls.
Maybe everyone should read the man page before commenting.
At a minimum, the "file type" codes are limited to inode types and one permission bit (exec). Output layout is limited to the `ls -l` format unless you parse & re-emit that in which case I would argue you are replacing `ls` just with `ls -l` instead of readdir/stat as a driver.
`lc` lets you define several kinds of new categories (besides classics like dot files and directories, for example ALL_CAPS or even file(1)/magic-based coding) and sort (or filter) by those in a multi-level sense in the unfolded (non-l) layout, not just the "-1" layout. As mentioned these categories are useful not only for colorization. This results in dense, but co-located big blocks of similar file types in the table. For example, I could group ELF executables differently than "simply perm-bit/access(3)" scripts. This is often helpful since the ELFs may not run across systems or can be rebuilt from sources. Similarly, I can group "dot directories" before "dot files" before "directories" before "non-directories-non-dots".
Besides file type limitations, there are also many other features in `lc` that would require increasingly sophisticated (and not generally available) shell tools and combinations. Just off the top of my head, the auto-glob abbreviation feature, other value-dependent formatting like file data sparseness, "3 char wide times" like "37w" for 37 weeks old, tweak files, etc. I doubt, were you to provide all these things that you would be able to persuade anyone that you were not "replacing ls" with something a notch or two more sophisticated. Could this replacement all be done with like find/stat/file/awk? Maybe, but I'd bet that would be pretty slow, especially on larger directories.
As to the value of said replacement, well, you may not care about any of these features and that is fine. I know smart people that mostly `ls -l|grep foo` - hardly using the features of the listing (or subdirectories!) at all. Yet none of my mentioned features involve color and it is simply incorrect to suggest just reading the man page reveals "trivial" ways to replicate them all. Combined with color, I think they are even more useful, but people vary on color. Anyway, cheers & good luck to you.
The overwhelming amount of time I don't need to see ownership/permission and modification time?
(Never mind the glob-abbreviation ability which while slow allows packing an enormous number of names per terminal row.)