This page looks best with JavaScript enabled

ls alternatives

 ·  ☕ 3 min read  ·  ✍️ Syed Dawood

Introduction

One question I get asked most frequently by anyone who sees me using terminal is

How do I get colors in ls?

Simple answers is you can’t. The command I am using is not ls at all. It is exa.
ls is one of the most used command. There is nothing wrong with ls, it is very plain though.

Why switch?

Below are few of the reasons you might consider switching

Color

Commandline is mostly black-white. Adding a little color won’t hurt. Be aware, getting used to it can be frustrataing to use other people’s terminal.

Informative

Apart from being colorful, makes it easier to read the output, especially the permissions section

Performance

There is on-going trend where GNU core utils are being re-written/implemented in rust . This is mostly done for performance gains. In this case, you will hardly notice any difference.

Icons

You will get nice icon for folders and files depending on the filetype. For icons to show up either Nerd font or Powerline fonts is required.

Looks cool

Leaving everything aside, this just look cool, increases your coolness factor by x among your peers. Just say’in !

Alternatives list

  • exa

A modern replacement for ‘ls’.
github

  • lsd

The next gen ls command
github

  • nat

ls alternative with useful info and a splash of color art
github

Having tried all, I have settled on exa.

Installation & Set up

Installation can be done using either rust package manager cargo or system package manager

1
cargo install exa
1
pacman -S exa
1
 apt install exa
1
dnf install exa
1
brew install exa  # Assuming you have homebrew setup 

Lets compare the output of ls and exa.

1
ls -l

output of ls -la

1
exa -Slhg --icons

output of exa with few flags

Configure

It is not practical to type exa with these flags everytime. It can be fixed with a simple alias

1
2
alias ll="exa -Slhg --icons"
alias la="exa -Slhga --icons"
1
2
alias ll="exa -Slhg --icons"
alias la="exa -Slhga --icons"

Screenshots

output of exa with few flags
output of exa with few flags
output of exa with few flags
output of exa with few flags

Conclusion

For someone who spends most of the time in terminal. Switching anyone of the above metioned alternative can provide a productivity boast and make life a little more colourful.

References

Share on

ALLSYED
WRITTEN BY
Syed Dawood
< frontend | backend | fullstack > Developer