moddedbear.com

Replacing the "ls" Command

I’ve been replacing the ls command on both my personal and work machine for so long that I’d honestly completely forgotten I was doing it until I saw someone else mention doing the same recently (can’t remember where, sorry!).

The tool I’ve been using is called Exa, and for my usage it’s a drop in replacement for ls with several helpful features and readability improvements.

I’ve been using shell aliases to call Exa when I type ls and also give myself a few useful shortcuts. Here’s what they look like in fish shell, equivalent aliases for bash, zsh, or whatever else you’re using might look slightly different.

alias ls 'exa'
alias tls 'exa --tree --icons'
alias lls 'exa -la --icons'
alias gls 'exa -la --icons --git'

The ls alias gives output very similar to the real ls just with more colors. The tls alias shows a tree view of the current directory with icons. The lls alias is a shortcut for a more detailed view with icons. The gls alias is the same as lls but it also shows git status for files.

As always, there are some pitfalls to be careful of if you start overriding core tools, the main one being that you might confuse behavior of the replacement with behavior of the core one which could throw you off when you find yourself using a different system. But like I said, I’ve had these aliases for years without any trouble.

Reply

#100DaysToOffload #linux