How To Make The Linux Terminal User Friendly With ColorLS
The Linux terminal has a solid UI. Most distributions have good defaults, and it makes using the command-line much easier. Still, for as great as the Linux terminal is, improvements are always welcome, especially those that make the Linux terminal user friendly.
SPOILER ALERT: Scroll down and watch the video tutorial at the end of this article.
Introducing ColorLS, a command-line addition that can make using the terminal much nicer. It adds nicer fonts, and icons next to different files in the command-line (like a music icon next to an MP3 file, a picture icon next to a JPG file, etc.)
Install Ruby
The ColorLS app requires work as there isn’t an easy way to install the software. As of now, there aren’t any downloadable packages, and no Linux distributions have direct support for the software. Instead, to use it, you must build the software from scratch.
ColorLS is a Ruby gem, so the Ruby programming language is a prerequisite. The Ruby programming language and run-time aren’t difficult to install on Linux.
To get Ruby, open a terminal and follow the instructions that correspond with your distribution.
Ubuntu
sudo apt install ruby ruby-dev git
Debian
sudo apt-get install ruby ruby-dev git
Arch Linux
sudo pacman -S ruby git
Fedora
sudo dnf install ruby git -y
OpenSUSE
sudo zypper install ruby git
Generic Linuxes
ColorLS needs Ruby, and there’s no way around it. If you don’t install it, ColorLS simply won’t run. Luckily, even the most obscure Linux distributions can easily install the Ruby language/runtime, due to some Linux programs made with Ruby.
Open up a terminal, use the package manager to search for “Ruby” and install it. Can’t get Ruby? Head over to the official website and build it manually. Be sure that you also install the Git tool, as it’s necessary for interacting with the various Git repos in this tutorial.
Install Fonts
The amazing features that ColorLS has come from a custom font. This font provides a customized look and so many other things that just aren’t possible with fonts that most Linux distributions ship with. As a result, before getting to use the ColorLS terminal add-on, you must install Nerd-Fonts.
Nerd-Fonts is huge and will take a long time to grab from GitHub. In a terminal, clone the files to your Linux PC.
git clone https://github.com/ryanoasis/nerd-fonts.git
Cloning the Nerd-Fonts files will take a long time, so it’s best to just leave the terminal window open and go do other things. When it completes, it’s time start the installation.
First, use the CD command and move the terminal into the “nerd-fonts” folder on your PC.
cd nerd-fonts
The Nerd-Fonts package comes with an installation script so that users don’t need to place the files on the system manually. Execute the script with:
./install.sh
Let the script install the fonts, but be patient, as installation takes quite a while.
Install ColorLS
ColorLS is up on Github, so to get it, open up a terminal and use the git clone command.
git clone https://github.com/athityakumar/colorls.git
Move the terminal into the sources folder with the CD command.
cd colorls
Install the program with the ruby command.
sudo gem install colorls
Using ColorLS
ColorLS is an application and doesn’t need any configuration to run. To take advantage of it, open up a terminal and run it in any directory.
colorls
Running the basic ColorLS command with no modifiers or switches will print out all files in the directory it’s in, along with special icons next to each file type. However, it will not show hidden files, unless the “a” switch is used.
colorls -a
View Permissions
Like the traditional LS command, ColorLS can view more than just files in a given directory. It can also determine the ownership of files, permission settings, sort files, etc. To view permissions with the ColorLS tool, run the following command in a terminal.
colorls -l
Sort Files By size
With the “S” switch, ColorLS can show and sort files with size in mind. To do this, run:
colorls -S
Only Show Folders
Want to view items in a directory but only want to see sub-folders? By running the ColorLS command with the d switch, you can. In a terminal, do the following.
colorls -d
Save ColorLS Command Arguments To File
There are dozens of different options for the ColorLS tool that make it a truly useful and colorful replacement to the LS command. If you’d like to see all of the command arguments, run ColorLS in a terminal with the help switch.
colorls --help
Alternatively, it’s possible to save the “help” information that appears when the above command is run by piping it to a text file.
colorls --help >> ~/Documents/colorls-commands.txt
View the contents of the text file in a terminal using the cat command.
cat ~/Documents/colorls-commands.txt