colorls usage

Are you a longtime lover of the humble list (aka ls) command?

If so, here’s a small Ruby gem which “beautifies” the command using colour and some flash font-awesome icons.

The result iss luscious as it is lucid!

Colorls for Bash

Colorls is the name of the script and it prettifies the humble ls output with selection of color and icons.

When used with other command line customisation options, like Oh my zsh and the powerlevel9k theme you can effect a really slick terminal setup like this:

You can get this look too

Before anyone scrolls down to tell me how utterly trivial this Gem is I must stress that triviality is the point here — this is pure eye-candy; a bit of Bash bling; it’s not intended to transform the way you use the terminal, merely make it nicer to gawk at.

When it comes to terminal commands every Ubuntu user should know ls is right up there. Running this two-letter prompt will print a list of all files and folders present within in the current directory.

But it can tell you more besides names.

Pass the ls command a flag or two and you can also see and/or sort by file format, size, date modified, and other data printed. The ls man page provides all the details on you what you can do using this command.

I mention all of that because, alas, not all of those options work with colorls — keep that in mind!

Install Colorls on Ubuntu

Like what you see and want to add colorls to your system? Great!

You need to install a few of things to get going: Ruby, the colorls Ruby Gem, and a modified font packed full of the glyphs.

Step one: Install Ruby (and its dependencies) from the Ubuntu repos:

sudo apt install ruby ruby-dev ruby-colorize

Step two: Download and install a patched version of your desired terminal font from Nerd Fonts.

Nerd Fonts is project that patches some popular fonts with an impressive amount of of glyphs and emoji. A patched version of Ubuntu Mono (the default terminal font on Ubuntu) is availablem as are a many others, including Roboto and Powerline.

Once your chosen font is installed do remember to set it as your custom font using the Terminal > Edit > Profile Preferences panel.

Specify a custom terminal font in Ubuntu

Step Three: Install the Colorls Ruby gem from the command line using this command:

sudo gem install colorls

Once the Gem downloads and build you’re all set: run the colorls command.

The developers of Colorls suggest adding a terminal alias for the tool, specifically ‘lc‘, which, if you’re not a Mono developer, shouldn’t conflict with anything else.

To create this terminal alias you need to modify the .bashrc file(s) and add alias lc='colorls' to do this.

Now when you run ‘lc‘ you’ll see a display of colorful information:

A few useful commands/options to use:

Running lc -r will display a readable ‘report’ on the number of files and folders in the specified folder(s).

Adding --sort-dirs or -sd--sort-files or -sf will sort by directories first, or files first, followed by a list alphabetically.

Using --dirs or -d / --files or -f filters entries to display only directories or files.

Adding -1 will display all entries in a single column.

command line Eye Candy ls terminal tweaks