This is your command line on lsd
Command Line – lsd

© Lead Image © bluedarkat, 123RF.com
A revamp of ls, lsd offers color coding plus revised options relevant to the modern computer.
If you work at the command line, you probably use ls
[1] frequently to list directories and their contents. However, it is one of the oldest commands, and many of its options are no longer relevant to modern computer use. In fact, most people can get by with only a small sub-set of its available options. One of several new revamps, lsd
(LSDeluxe) [2] (Figure 1) attempts to modernize and simplify ls
by assuming a default color code and – apparently – by reducing the number of options and adding options of its own. However, since this is 0.2.21 release, it is hard to be sure exactly what the general release will look like.
The lsd
release page includes Linux packages for Debian and Gentoo. An alternative is to build from source with the Rust Cargo package manager or install a Snap package. Should you install from source, you will also need to install Nerd Fonts [3] in order to use fancy icons to identify file types.
On installation – or perhaps later, after you have tried lsd
and have a better sense of what it can do – you may also want to add a configuration file (Figure 2), copying and modifying the sample provided on the project page. This configuration file should be placed in ~/.config/lsd/config.yaml
. Table 1 lists the main fields available and their settings. Default configurations can be overridden from the command line but can reduce the length of entered commands.
Table 1
Selected Configuration Settings
Field | Description | Values | Default |
---|---|---|---|
|
Sets backward compatibility with |
|
|
|
Specifies the columns and their order |
|
|
|
When to colorize |
|
|
|
Date format for |
|
|
|
Whether to dereference symbolic links |
|
|
|
What items to display |
|
|
|
When to use icons |
|
|
|
Which icon theme to use |
|
|
|
How the icon is separated from the file name |
|
Single space |
|
Which layout to use |
|
|
|
Whether to enable recursion |
|
|
|
The recursion depth |
Any positive number |
|
|
The format of the |
|
|
|
Specify what to sort by |
|
|
|
Whether to reverse the sorting |
|
|
|
Whether to group directories and where |
|
|
Note that in the current release the set colors cannot be altered, although that may change in later releases. Figure 3 shows the default colors currently in use. Colors are only the most obvious ways that directories and files can be coded, the others being --icons
and --icon-themes
(Figure 4) and --classify
(-F
), which uses special characters (*, /, =, >, @, and |) to indicate file types. Probably, most users will want to use only one of these choices.
Options
The current ls
command has 58 options. By contrast, the current lsd
release has 25. More might be added before the general release, but lsd
is already a functional match for ls
and broadly backwardly compatible with it, with much of the same structural logic. However, some of the ls
options are less relevant than they once were. For instance, today only a few applications like Bluefish use ~
to indicate a backup file, so the ls
option --ignore-backups
(-B
) is unlikely to be missed. Similarly, the decline of Emac's popularity means that the --dired
(-D
) option to generate output for Emac's Dired mode seems no longer necessary or at least a low priority to implement. Nor does lsd
require the -C
option for displaying in columns – because it does so by default and other options such as tree or single-line displays are folded into the same command. The overall result is that lsd
is easier to learn than ls
, especially when more than basic options are used.
So what options are left? First, the options that can be placed in a configuration file (Figure 2). They take the same possible values as in the configuration file and override the file as well. Another set of options are those found in ls
. In particular, --all
(-a
) displays dot
files, and --nosymlink
does not display symbolic links, while -directly-only
(-d
) lists only directories. The same sorting options are also used: --recursive
(-r
), --reverse
(-r
), --sizesort
(-s
), and --timesort
(-t
), all of which are self-explanatory. Other options include --total-size
, which displays the total size of directories, and --oneline
(-1
) and --tree
, which offer alternative displays (Figure 5 and 6). And if you have no wish for color or icon coding, you can use --classic
to suppress them. If you are proficient with ls
, many of these options will be familiar.
Naturally, which options you require depends on your current tasks, but you are likely to develop preferences in layout. When you do, consider creating an alias for lsd
so that you have no need to break the habit of typing ls
. To give the simplest alias, in your ~/.bashrc
file or its equivalent, add the line:
<C>alias ls='lsd'<C>
You may want to set other aliases for lsd
, each with its own set of options.
Other ls Updates
In addition to lsd
, at least five more revisions of ls
are competing for the same niche: exa
, colorls
, ls++
, ls-go
, and k
. Many of these are released under an MIT license, and most focus on a color display. However, lsd
is an ideal place to begin exploring the new alternatives. Backwards compatibility makes it an obvious replacement for ls
. While various forms of file coding may be too complex for some users, lsd
offers several choices. However, if lsd
is not for you, you have others to fall back on. Obviously, the time has come to revamp one of Linux's most basic commands.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
News
-
An All-Snap Version of Ubuntu is In The Works
Along with the standard deb version of the open-source operating system, Canonical will release an-all snap version.
-
Mageia 9 Beta 2 Ready for Testing
The latest beta of the popular Mageia distribution now includes the latest kernel and plenty of updated applications.
-
KDE Plasma 6 Looks to Bring Basic HDR Support
The KWin piece of KDE Plasma now has HDR support and color management geared for the 6.0 release.
-
Bodhi Linux 7.0 Beta Ready for Testing
The latest iteration of the Bohdi Linux distribution is now available for those who want to experience what's in store and for testing purposes.
-
Changes Coming to Ubuntu PPA Usage
The way you manage Personal Package Archives will be changing with the release of Ubuntu 23.10.
-
AlmaLinux 9.2 Now Available for Download
AlmaLinux has been released and provides a free alternative to upstream Red Hat Enterprise Linux.
-
An Immutable Version of Fedora Is Under Consideration
For anyone who's a fan of using immutable versions of Linux, the Fedora team is currently considering adding a new spin called Fedora Onyx.
-
New Release of Br OS Includes ChatGPT Integration
Br OS 23.04 is now available and is geared specifically toward web content creation.
-
Command-Line Only Peropesis 2.1 Available Now
The latest iteration of Peropesis has been released with plenty of updates and introduces new software development tools.
-
TUXEDO Computers Announces InfinityBook Pro 14
With the new generation of their popular InfinityBook Pro 14, TUXEDO upgrades its ultra-mobile, powerful business laptop with some impressive specs.