• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H12-Apr-2021-4531

cargo-crates/H03-May-2022-1,461,3071,160,034

completions/H12-Apr-2021-191173

devtools/H12-Apr-2021-742419

man/H12-Apr-2021-544338

snap/H12-Apr-2021-2823

src/H12-Apr-2021-10,7147,071

xtests/H12-Apr-2021-2,0721,720

.gitignoreH A D12-Apr-2021287 2218

.rustfmt.tomlH A D12-Apr-202130 21

.travis.ymlH A D12-Apr-2021312 2017

Cargo.lockH A D12-Apr-20219.9 KiB395350

Cargo.tomlH A D12-Apr-20211.5 KiB7863

JustfileH A D12-Apr-20212.6 KiB11182

LICENCEH A D12-Apr-20211.1 KiB2217

README.mdH A D12-Apr-202111.2 KiB278181

VagrantfileH A D12-Apr-20215.9 KiB167125

build.rsH A D12-Apr-20213.6 KiB12373

README.md

1<div align="center">
2<h1>exa</h1>
3
4[exa](https://the.exa.website/) is a modern replacement for _ls_.
5
6**README Sections:** [Options](#options) — [Installation](#installation) — [Development](#development)
7
8<a href="https://travis-ci.org/github/ogham/exa">
9    <img src="https://travis-ci.org/ogham/exa.svg?branch=master" alt="Build status" />
10</a>
11
12<a href="https://saythanks.io/to/ogham%40bsago.me">
13    <img src="https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg" alt="Say thanks!" />
14</a>
15</div>
16
17![Screenshots of exa](screenshots.png)
18
19---
20
21**exa** is a modern replacement for the venerable file-listing command-line program `ls` that ships with Unix and Linux operating systems, giving it more features and better defaults.
22It uses colours to distinguish file types and metadata.
23It knows about symlinks, extended attributes, and Git.
24And it’s **small**, **fast**, and just **one single binary**.
25
26By deliberately making some decisions differently, exa attempts to be a more featureful, more user-friendly version of `ls`.
27For more information, see [exa’s website](https://the.exa.website/).
28
29
30---
31
32<a id="options">
33<h1>Command-line options</h1>
34</a>
35
36exa’s options are almost, but not quite, entirely unlike `ls`’s.
37
38### Display options
39
40- **-1**, **--oneline**: display one entry per line
41- **-G**, **--grid**: display entries as a grid (default)
42- **-l**, **--long**: display extended details and attributes
43- **-R**, **--recurse**: recurse into directories
44- **-T**, **--tree**: recurse into directories as a tree
45- **-x**, **--across**: sort the grid across, rather than downwards
46- **-F**, **--classify**: display type indicator by file names
47- **--colo[u]r**: when to use terminal colours
48- **--colo[u]r-scale**: highlight levels of file sizes distinctly
49- **--icons**: display icons
50- **--no-icons**: don't display icons (always overrides --icons)
51
52### Filtering options
53
54- **-a**, **--all**: show hidden and 'dot' files
55- **-d**, **--list-dirs**: list directories like regular files
56- **-L**, **--level=(depth)**: limit the depth of recursion
57- **-r**, **--reverse**: reverse the sort order
58- **-s**, **--sort=(field)**: which field to sort by
59- **--group-directories-first**: list directories before other files
60- **-D**, **--only-dirs**: list only directories
61- **--git-ignore**: ignore files mentioned in `.gitignore`
62- **-I**, **--ignore-glob=(globs)**: glob patterns (pipe-separated) of files to ignore
63
64Pass the `--all` option twice to also show the `.` and `..` directories.
65
66### Long view options
67
68These options are available when running with `--long` (`-l`):
69
70- **-b**, **--binary**: list file sizes with binary prefixes
71- **-B**, **--bytes**: list file sizes in bytes, without any prefixes
72- **-g**, **--group**: list each file’s group
73- **-h**, **--header**: add a header row to each column
74- **-H**, **--links**: list each file’s number of hard links
75- **-i**, **--inode**: list each file’s inode number
76- **-m**, **--modified**: use the modified timestamp field
77- **-S**, **--blocks**: list each file’s number of file system blocks
78- **-t**, **--time=(field)**: which timestamp field to use
79- **-u**, **--accessed**: use the accessed timestamp field
80- **-U**, **--created**: use the created timestamp field
81- **-@**, **--extended**: list each file’s extended attributes and sizes
82- **--changed**: use the changed timestamp field
83- **--git**: list each file’s Git status, if tracked or ignored
84- **--time-style**: how to format timestamps
85- **--no-permissions**: suppress the permissions field
86- **--octal-permissions**: list each file's permission in octal format
87- **--no-filesize**: suppress the filesize field
88- **--no-user**: suppress the user field
89- **--no-time**: suppress the time field
90
91Some of the options accept parameters:
92
93- Valid **--color** options are **always**, **automatic**, and **never**.
94- Valid sort fields are **accessed**, **changed**, **created**, **extension**, **Extension**, **inode**, **modified**, **name**, **Name**, **size**, **type**, and **none**. Fields starting with a capital letter sort uppercase before lowercase. The modified field has the aliases **date**, **time**, and **newest**, while its reverse has the aliases **age** and **oldest**.
95- Valid time fields are **modified**, **changed**, **accessed**, and **created**.
96- Valid time styles are **default**, **iso**, **long-iso**, and **full-iso**.
97
98
99---
100
101<a id="installation">
102<h1>Installation</h1>
103</a>
104
105exa is available for macOS and Linux.
106More information on how to install exa is available on [the Installation page](https://the.exa.website/install).
107
108### Alpine Linux
109
110On Alpine Linux, [enable community repository](https://wiki.alpinelinux.org/wiki/Enable_Community_Repository) and install the [`exa`](https://pkgs.alpinelinux.org/package/edge/community/x86_64/exa) package.
111
112    $ apk add exa
113
114### Arch Linux
115
116On Arch, install the [`exa`](https://www.archlinux.org/packages/community/x86_64/exa/) package.
117
118    $ pacman -S exa
119
120### Android / Termux
121
122On Android / Termux, install the [`exa`](https://github.com/termux/termux-packages/tree/master/packages/exa) package.
123
124    $ pkg install exa
125
126### Debian
127
128On Debian, install the [`exa`](https://packages.debian.org/unstable/exa) package.
129For now, exa is in the _unstable_ repository.
130
131    $ apt install exa
132
133### Fedora
134
135On Fedora, install the [`exa`](https://src.fedoraproject.org/modules/exa) package.
136
137    $ dnf install exa
138
139### Gentoo
140
141On Gentoo, install the [`sys-apps/exa`](https://packages.gentoo.org/packages/sys-apps/exa) package.
142
143    $ emerge sys-apps/exa
144
145### Homebrew
146
147If you’re using [Homebrew](https://brew.sh/) on macOS, install the [`exa`](http://formulae.brew.sh/formula/exa) formula.
148
149    $ brew install exa
150
151### MacPorts
152
153If you're using [MacPorts](https://www.macports.org/) on macOS, install the [`exa`](https://ports.macports.org/port/exa/summary) port.
154
155    $ port install exa
156
157### Nix
158
159On nixOS, install the [`exa`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/exa/default.nix) package.
160
161    $ nix-env -i exa
162
163### openSUSE
164
165On openSUSE, install the [`exa`](https://software.opensuse.org/package/exa) package.
166
167    $ zypper install exa
168
169### Ubuntu
170
171On Ubuntu 20.10 (Groovy Gorilla) and later, install the [`exa`](https://packages.ubuntu.com/groovy/exa) package.
172
173    $ sudo apt install exa
174
175### Void Linux
176
177On Void Linux, install the [`exa`](https://github.com/void-linux/void-packages/blob/master/srcpkgs/exa/template) package.
178
179    $ xbps-install -S exa
180
181### Manual installation from GitHub
182
183Compiled binary versions of exa are uploaded to GitHub when a release is made.
184You can install exa manually by [downloading a release](https://github.com/ogham/exa/releases), extracting it, and copying the binary to a directory in your `$PATH`, such as `/usr/local/bin`.
185
186For more information, see the [Manual Installation page](https://the.exa.website/install/linux#manual).
187
188### Cargo
189
190If you already have a Rust environment set up, you can use the `cargo install` command:
191
192    $ cargo install exa
193
194Cargo will build the `exa` binary and place it in `$HOME/.cargo`.
195
196To build without Git support, run `cargo install --no-default-features exa` is also available, if the requisite dependencies are not installed.
197
198
199---
200
201<a id="development">
202<h1>Development
203
204<a href="https://blog.rust-lang.org/2020/03/12/Rust-1.42.html">
205    <img src="https://img.shields.io/badge/rustc-1.42+-lightgray.svg" alt="Rust 1.42+" />
206</a>
207
208<a href="https://github.com/ogham/exa/blob/master/LICENCE">
209    <img src="https://img.shields.io/badge/licence-MIT-green" alt="MIT Licence" />
210</a>
211</h1></a>
212
213exa is written in [Rust](https://www.rust-lang.org/).
214You will need rustc version 1.42.0 or higher.
215The recommended way to install Rust for development is from the [official download page](https://www.rust-lang.org/tools/install), using rustup.
216
217Once Rust is installed, you can compile exa with Cargo:
218
219    $ cargo build
220    $ cargo test
221
222- The [just](https://github.com/casey/just) command runner can be used to run some helpful development commands, in a manner similar to `make`.
223Run `just --tasks` to get an overview of what’s available.
224
225- If you are compiling a copy for yourself, be sure to run `cargo build --release` or `just build-release` to benefit from release-mode optimisations.
226Copy the resulting binary, which will be in the `target/release` directory, into a folder in your `$PATH`.
227`/usr/local/bin` is usually a good choice.
228
229- To compile and install the manual pages, you will need [pandoc](https://pandoc.org/).
230The `just man` command will compile the Markdown into manual pages, which it will place in the `target/man` directory.
231To use them, copy them into a directory that `man` will read.
232`/usr/local/share/man` is usually a good choice.
233
234- exa depends on [libgit2](https://github.com/rust-lang/git2-rs) for certain features.
235If you’re unable to compile libgit2, you can opt out of Git support by running `cargo build --no-default-features`.
236
237- If you intend to compile for musl, you will need to use the flag `vendored-openssl` if you want to get the Git feature working.
238The full command is `cargo build --release --target=x86_64-unknown-linux-musl --features vendored-openssl,git`.
239
240For more information, see the [Building from Source page](https://the.exa.website/install/source).
241
242
243### Testing with Vagrant
244
245exa uses [Vagrant][] to configure virtual machines for testing.
246
247Programs such as exa that are basically interfaces to the system are [notoriously difficult to test][testing].
248Although the internal components have unit tests, it’s impossible to do a complete end-to-end test without mandating the current user’s name, the time zone, the locale, and directory structure to test.
249(And yes, these tests are worth doing. I have missed an edge case on many an occasion.)
250
251The initial attempt to solve the problem was just to create a directory of “awkward” test cases, run exa on it, and make sure it produced the correct output.
252But even this output would change if, say, the user’s locale formats dates in a different way.
253These can be mocked inside the code, but at the cost of making that code more complicated to read and understand.
254
255An alternative solution is to fake *everything*: create a virtual machine with a known state and run the tests on *that*.
256This is what Vagrant does.
257Although it takes a while to download and set up, it gives everyone the same development environment to test for any obvious regressions.
258
259[Vagrant]: https://www.vagrantup.com/
260[testing]: https://eev.ee/blog/2016/08/22/testing-for-people-who-hate-testing/#troublesome-cases
261
262First, initialise the VM:
263
264    host$ vagrant up
265
266The first command downloads the virtual machine image, and then runs our provisioning script, which installs Rust and exa’s build-time dependencies, configures the environment, and generates some awkward files and folders to use as test cases.
267Once this is done, you can SSH in, and build and test:
268
269    host$ vagrant ssh
270    vm$ cd /vagrant
271    vm$ cargo build
272    vm$ ./xtests/run
273    All the tests passed!
274
275Of course, the drawback of having a standard development environment is that you stop noticing bugs that occur outside of it.
276For this reason, Vagrant isn’t a *necessary* development step — it’s there if you’d like to use it, but exa still gets used and tested on other platforms.
277It can still be built and compiled on any target triple that it supports, VM or no VM, with `cargo build` and `cargo test`.
278