sl takes the most common use of Unix
ls, to display the files in a directory compactly in multiple columns, and makes it substantially more useful.
sl is also aesthetically pleasing due to attention to layout and filtering as well as limiting color and text annotations to salient information.
ls vs sl on WWW site:
sl on a software development directory:
sl on a collection (photos, audio, video, even apps):
On this directory of music, which is managed by iTunes, we see all the albums by an artist. sl also shows /number of songs in each album, the relatively recent CD rips (which not coincidentally correspond to the latest two albums), which we ripped about 2 months ago (58 days) and 7 months ago (228 days). The summary line at bottom shows the total number of CDs and the (total number) of songs. Note that the directories were determined to hold audio material, and sorting works as it should with inital "The"s ignored. This display is useful for other kinds of hierarchy.
10.jpg— no need for leading 0s just for sorting)
large files relative to other files in that directory (indent by a space — easy to pick out against column edge)
ls -F): directory
ls -G, though more subtle since have groupings and warnings)
-age), recently changed (
<implying it may be earlier if a download or sloppy copy reset the last modified time), and relatively large (
size-in-bytes). Per-file customizations can display, for example, latest build time and build number next to Ant
build.xml, count of critical bugs filed against source code file, number of lines in TODO list, warning if HTML has not been validated, you name it.
/number of filesin subdirectories, which can be a useful if rough survey (this is not slow)
Yosemite 2007 photos/316vs
ls -B), generated (Java
audiobook ch 01.mp3...
audiobook ch 27.mp3) and condense to first one plus count
DSC00423.jpg...227. Also look at
-onlycommand-line option to distill the listing to only distinctive files. A file is considered distinctive if it's: recently changed, recently read, a warning, or spot info.
/usr/binand OS X
/Library/Fontscan be interesting.
lsdictated by the single longest filename in the directory), giving a more natural appearance and freeing space for more columns
sl does not replace
ls to see all files and full metadata.
for OS X, Solaris, Unix, and GNU/Linux
Licensed under the GNU Public License version 3. NO WARRANTY.
chmod +x download-dir/sl unalias sl rehash
which tclshcomes up empty). Install into
/usr/local/binor change the first line of the sl script. Tcl is already installed in OS X.
Use: Now more-useful listings are as convenient to type as the usual
Convenience: Automatically see an overview and interesting files when switching to a new directory:
alias cd 'cd \!*; sl' alias pd 'pushd \!*; sl' alias pdo 'pushd \!*; sl -only'
Customization is done via a startup file, at the path
You can control colors, new suffixes, localization of the most used text, switches that control system operation,
and even exactly what is shown for every file.
For example, here's a custom color scheme that makes files and directories brighter
and blends the text annotations into the background.
The startup file is executed as Tcl code, so you can implement substantial changes, such as adding support for another version control system. Rather than hacking the source code, it is better to put customizations in the startup file so that you can easily update to new versions without reapplying your hacks. Tcl lets you go so far as redefining whole procedures, so any change you want can be done in the startup file.
.sl.tclsample startup file, download to your home directory. It shows how to make many of the most likely changes, as well as how to turn on features that are too mind blowing to be the default settings, including prefix and suffix elision.
^[[31m, enable color for your terminal or turn off color in your startup file.
less, set the
LESSenvironment variable to include
no such file or directory, but file definitely exists. If you have a legacy filesystem with filenames that are not encoded in Unicode UTF-8 (or ASCII, which is a subset of UTF-8), you should migrate the names to UTF-8 with a tool such as convmv. sl tries to handle this situation, but for paths passed to it on the command line it is already too late.
lswas a misspelling. In some systems, it resulted in a
Command not founderror. Some shells prepared for this and aliased the transposition and other misspellings to in effect autocorrect to what the user meant to type. If the output still looks like
ls, it's probably an alias. You can unalias in open terminals and take out the line in the shell startup file. In another case, a Linux distribution surprised you with ASCII art of a train. You can delete it, or if an ASCII train is a key part of your problem-solving toolkit you can rename it.
Send suggestions and bug reports to
Invented by Tom Phelps on December 30, 2011.