sl

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 groups files by purpose so you can mentally organize many files quickly; for instance, it collects HTML and PHP files together, as opposed to leaving them mixed up with supporting images, CSS, and JavaScript. sl points out interesting files, which include those that have been recently modified, read relatively recently, are relatively large, have warnings, or need to be checked in to or out of version control.

sl is also aesthetically pleasing due to attention to layout and filtering as well as limiting color and text annotations to salient information.


Screen Shots

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.

Features

sl does not replace ls. Use ls to see all files and full metadata.

Software

for OS X, Solaris, Unix, and GNU/Linux
Licensed under the GNU Public License version 3. NO WARRANTY.

Install:

  1. Download software, probably to /usr/local/bin or ~/bin.
  2. From the command line:
    chmod +x download-dir/sl
    unalias sl
    rehash
    
  3. Install Tcl, if needed (which tclsh comes up empty). Install into /usr/local/bin or 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 ls.

sl directory-path

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

Customization is done via a startup file, at the path ~/.sl.tcl. 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.

Support

Troubleshooting:

Known bugs:

Send suggestions and bug reports to


Invented by Tom Phelps on December 30, 2011.