exa

Long view

exa’s long view displays not only the names of the files you list, but also their metadata, including permission bits, file sizes, timestamps, and more.

To use long mode, pass the -l or --long command-line option to exa.

Unix permission bits

The left-most column displays a file’s type and its permission bits.

Its first character represents the type of the file. The next three triplets refer to the read, write, and execute bits for the file’s owner, its group, and all others respectively.

Finally, exa will display a @ symbol for any file that has at least one extended attribute.

exa --header --long --list-dirs build.rs contrib /dev/{stdout,tun0}
Permissions Size User Date Modified Name
.rw-r--r--  1.9k ben   8 Oct 21:04  build.rs
drwxr-xr-x@    - ben  30 Sep  8:17  contrib
lr-xr-xr-x     0 root 29 Nov 14:06  /dev/stdout -> fd/1
crw-rw----   0,0 root 29 Nov 14:06  /dev/tun0

File sizes

exa lists file sizes using decimal prefixes by default: bytes, kilobytes, megabytes, gigabytes, and so on. There are two ways to use a different format:

  • Use -b or --binary to use binary prefixes: kibibytes, mibibytes, gibibytes, and so on.
  • Use -B or --bytes to use no prefixes at all and display sizes as exact numbers of bytes.

The size column displays the major and minor device IDs when listing a block or character device.

exa --header --long data.dump profiles.json
Permissions Size User Date Modified Name
.rw-r--r--  125M ben   5 Oct 20:59  data.dump
.rw-r--r--  5.7k ben  21 Sep 15:01  profiles.json

exa --binary --header --long data.dump profiles.json
Permissions  Size User Date Modified Name
.rw-r--r--  119Mi ben   5 Oct 20:59  data.dump
.rw-r--r--  5.5Ki ben  21 Sep 15:01  profiles.json

exa --bytes --header --long data.dump profiles.json
Permissions        Size User Date Modified Name
.rw-r--r--  125,132,800 ben   5 Oct 20:59  data.dump
.rw-r--r--        5,673 ben  21 Sep 15:01  profiles.json

Owners and Groups

A file has one owner and one group. It’s these values that govern which users are allowed to do what to each particular file: for example, a program might be executable by all members in a certain group, and readable by everybody, but only writable by its owner.

exa will examine the current user and look up the list of groups that they are a member of, so it can highlight that user’s own files.

The group column is hidden by default, but it can be displayed with the -g or --group command-line option.

exa -d --header --group --long /Users /Users/ben /Users/Guest
Permissions Size User Group  Date Modified Name
drwxr-xr-x     - ben  staff  30 Nov  8:39  /Users/ben
drwxr-xr-x     - 201  _guest 14 Aug 11:29  /Users/Guest
drwxr-xr-x     - root admin  14 Oct 16:22  /Users

File timestamps

A file has three timestamps associated with it, which track the times the file was used. You can set which timestamp to display with the -t or --time argument.

  • The modified timestamp is the default, which tracks when this file’s contents were last changed (the mtime).
  • The accessed timestamp tracks when this file was last accessed (the atime.)
  • The changed timestamp tracks when this file’s metadata was last changed (the ctime).

Supplying a timestamp argument will replace the modified column with the one selected, and supplying two or more arguments will display two or more columns.

Furthermore, you can select which format the timestamps should be displayed in:

  • default uses the current locale to print month names, specifies the timestamp down to the minute for times in the current year, and down to the day for previous years.
  • iso does the same, except using a month for the number so it doesn’t need to look up the locale.
  • long-iso specifies the timestamp down to the minute without using the locale or current year.
  • full-iso specifies the timestamp down to the millisecond, including its offset down to the minute, without using the locale or current year.
exa -lh --accessed --modified --created 'Tube map.pdf' 'World map.pdf'
Permissions Size User Date Modified Date Created Date Accessed Name
.rw-r--r--@ 645k ben  23 May 19:27  14 Aug 21:04 19 Aug  9:22  Tube map.pdf
.rw-r--r--@ 459k ben   8 Jul  9:34  16 Aug 19:49 19 Aug  9:23  World map.pdf

exa -lh -t=mod --time-style=long-iso 'Tube map.pdf' 'World map.pdf'
Permissions Size User Date Modified    Name
.rw-r--r--@ 645k ben  2017-05-23 19:27 Tube map.pdf
.rw-r--r--@ 459k ben  2017-07-08 09:34 World map.pdf

Other metadata fields

There are three other metadata fields that are worthy of mention:

  • The number of hard links can be shown with the -H or --links arguments.
  • The inode can be shown with the -i or --inode command-line arguments.
  • The number of filesystem blocks can be shown with the -S or --blocks command-line arguments.

Long grid view

The disadvantage of the long view is that it lists files downwards instead of across. If you have a widescreen monitor, or just a large terminal window, you might find yourself wishing you could make better use of the empty space.

exa’s solution to this is long grid view. By passing the --grid option alongside the --long option, the long view will be split among several larger columns, which will automatically resize themselves to fit all the contents in the screen.

exa --long --grid /bin
.rwxr-xr-x  22k root  3 Oct  6:51 [        .r-xr-xr-x  18k root  3 Oct  6:51 domainname    .rwxr-xr-x  19k root  3 Oct  6:51 ln       .r-xr-xr-x 618k root  3 Oct  6:51 sh
.r-xr-xr-x 618k root  3 Oct  6:51 bash     .rwxr-xr-x  18k root  3 Oct  6:51 echo          .rwxr-xr-x  38k root  3 Oct  6:51 ls       .rwxr-xr-x  18k root  3 Oct  6:51 sleep
.rwxr-xr-x  23k root  3 Oct  6:51 cat      .rwxr-xr-x  54k root  3 Oct  6:51 ed            .rwxr-xr-x  18k root  3 Oct  6:51 mkdir    .rwxr-xr-x  32k root  3 Oct  6:51 stty
.rwxr-xr-x  30k root  3 Oct  6:51 chmod    .rwxr-xr-x  23k root  3 Oct  6:51 expr          .rwxr-xr-x  24k root  3 Oct  6:51 mv       .rwxr-xr-x  42k root 25 Oct 18:30 sync
.rwxr-xr-x  29k root  3 Oct  6:51 cp       .rwxr-xr-x  18k root  3 Oct  6:51 hostname      .rwxr-xr-x 111k root  3 Oct  6:51 pax      .rwxr-xr-x 380k root  3 Oct  6:51 tcsh
.rwxr-xr-x 380k root  3 Oct  6:51 csh      .rwxr-xr-x  18k root  3 Oct  6:51 kill          .rwsr-xr-x  51k root  3 Oct  6:51 ps       .rwxr-xr-x  22k root  3 Oct  6:51 test
.rwxr-xr-x  28k root  3 Oct  6:51 date     .r-xr-xr-x 1.3M root  3 Oct  6:51 ksh           .rwxr-xr-x  18k root  3 Oct  6:51 pwd      .rwxr-xr-x  23k root  3 Oct  6:51 unlink
.rwxr-xr-x  31k root  3 Oct  6:51 dd       .rwxr-xr-x 124k root 25 Oct 18:30 launchctl     .rwxr-xr-x  23k root  3 Oct  6:51 rm       .rwxr-xr-x  42k root 25 Oct 18:30 zsh
.rwxr-xr-x  23k root  3 Oct  6:51 df       .rwxr-xr-x  19k root  3 Oct  6:51 link          .rwxr-xr-x  18k root  3 Oct  6:51 rmdir

My files’ accessed dates are wrong!

Confusingly, many OSes are configured not to update a file’s accessed date every time it gets read, or even at all! exa just reports the atime field given to it by the OS, so if you require up-to-date file access times, you may have to configure your OS or filesystem differently.

The main reason behind this is that, with file access times active, each file read (usually quick) will automatically become a file write (much slower). Linux uses relative access times by default, for example, meaning the time will only be updated once a day.