Terminal : lsd list files with colors and icons

If you regularly use a terminal Unix, surely you know the command ls which is used to display lists of files contained in the folders. This is one of the basic commands that we use very often when you want to navigate in a hierarchy without the graphical interface, but you can find it a little sad. It displays in general a few colors to distinguish between files and folders, and you can get additional information of sizes and permissions, but not much more.


Using the command ls -lAh, you get a list of folders and files with colors to distinguish the types (records in blue and script in red…), and other information, weight of files and permissions.

This command was created in 1970 for the first UNIX system, and even if it has experienced a few changes since, it remains quite simple. If you find that this historic order was in need of a successor, you ‘ll enjoy the lsd, a tool that is more recent charge to replace ls. Coded in Rust, it displays more colors and especially of the icons, to distinguish not only the folders of the files, but also files based on their file type.


The same folder, with the command lsd -lAh. Each file has its own icon, and the permissions are easier to read, thanks to the addition of colors.

Unlike ls which is available from the base in all Unix systems, including macOS, you will need to install lsd. You will also need to install a font, for the associated icons for each file type. Here are the commands to enter on macOS, with the prerequisite that you have configured the package manager Homebrew on your machine.


Installation of lsd :


brew install lsd

Installation of Cask Fonts (download manager fonts via Homebrew) :


brew tap homebrew/cask-fonts

Installing the font Hack Nerd Font that contains the icons :


brew cask install font-hack-nerd-are

Installation of lsd and its dependencies on a Mac.

Once this is done, you still need to configure your app in terminal, which displays the session in Unix. If you use Terminal, the app of the basis of macOS, you will need to open the preferences, and then click on “Profiles” and then click the “Edit” button in the ” Font “. Then, choose “Hack” Regular “Nerd” in the window that opens.


Configuration of the app to the Terminal of macOS to display the icons.

If you use iTerm2, open its preferences, and then ” Profile “, choose the correct profile and open the section ” Text “. At the bottom of the window, choose “Hack Nerd” in the drop-down list under the heading ” Non-ASCII Font “.


Configuration of the app iTerm2 to display the icons of the files.

This configuration is done profile by profile. If you have saved several profiles in iTerm, you’ll have to change them all to see the icons everywhere. But once everything is done, you can use the command lsd as you were using ls before. If you want to tap into it daily, you should replace the old command with an alias to overload the ls.


The lists generated by lsd are more readable, especially when you display the permissions, with colors to better read the rights for each file. On the other hand, the date is presented only in English, so that it is translated in French with ls. The colors are explained here and can be modified in the future, but this is not the case in the current version.


Up to you to see if this alternative is interesting or if you want just the basic command. lsd is an open-source project and its installation is completely free.



In this issue, our practical manual to know Everything about : The terminal is still available on Apple Books for 4,99 €. You will discover this textual interface, with a base to start on macOS, or on any GNU/Linux system.


Comments