old-www/LDP/LG/issue48/fischer.html

325 lines
8.5 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>A Brief History of the 'ls' command LG #48</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!-- *** BEGIN navbar *** -->
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="dellomodarme.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../faq/index.html"><IMG ALT="[ Linux Gazette FAQ ]"
SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="fisher.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom ></A>
<!-- *** END navbar *** -->
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">A Brief History of the 'ls' command</font></H1>
<H4>By <a href="mailto:enf@pobox.com">Eric Fischer</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
The <tt>ls</tt> command, which lists files,
is one of the most essential
utilities for Unix and Linux users and, not surprisingly, one of the
oldest. In its earliest form it was called <tt>listf</tt>
and was available
on the Massachusetts Institute of Technology's Compatible Time Sharing
System (CTSS) by July, 1961. By 1963, there were a few options that could be
used to vary what <tt>listf</tt> would list:
<p>
<table>
<tr>
<td><tt>listf</tt></td>
<td>list files, newest first</td>
</tr>
<tr>
<td><tt>listf rev</tt></td>
<td>list files, oldest first</td>
</tr>
<tr>
<td><tt>listf</tt> <i>file</i> <i>extension</i></td>
<td>give information about the named file</td>
</tr>
<tr>
<td><tt>listf</tt> <i>month</i> <i>day</i> <i>year</i></td>
<td>list files older than the given date</td>
</tr>
</table>
<p>
In 1965, listf was extended to recognize ``<tt>*</tt>'' as a way to list all
files that matched a specific pattern, with further improvements to
the pattern matching in an updated version dated January 3, 1966.
The 1966 version also generalized the syntax and added lots of
options, including:
<p>
<table>
<tr>
<td><tt>listf (file)</tt></td>
<td>list only files, not links</td>
</tr>
<tr>
<td><tt>listf (auth)</tt> <i>user</i></td>
<td>list files created by the given user</td>
</tr>
<tr>
<td><tt>listf (made)</tt> <i>mmddyy</i> [<i>mmddyy</i>]</td>
<td>list files created between the given dates</td>
</tr>
<tr>
<td><tt>listf (srec)</tt></td>
<td>list by size</td>
</tr>
<tr>
<td><tt>listf (smad)</tt></td>
<td>list by date of last modification</td>
</tr>
<tr>
<td><tt>listf (rev)</tt></td>
<td>list in reverse order</td>
</tr>
<tr>
<td><tt>listf (long)</tt></td>
<td>list in long format</td>
</tr>
</table>
<p>
When CTSS was superseded by Multics, the <tt>listf</tt> command
was renamed to <tt>list</tt>, which could optionally be
abbreviated to <tt>ls</tt>. The early version of
<tt>ls</tt> had fewer options than late versions of
<tt>listf</tt> had, but still included, along with a few others:
<p>
<table>
<tr>
<td><tt>list -all</tt></td>
<td>(<tt>ls -a</tt>)</td>
<td>list everything</td>
</tr>
<tr>
<td><tt>list -date_time_modified</tt></td>
<td>(<tt>ls -dtm</tt>)</td>
<td>list by date of last modification</td>
</tr>
<tr>
<td><tt>list -reverse</tt></td>
<td>(<tt>ls -rv</tt>)</td>
<td>list in reverse order</td>
</tr>
</table>
<p>
When Bell Labs dropped out of Multics development in 1969 and work began on
Unix, only the abbreviated name of <tt>list</tt>, <tt>ls</tt>, was
retained. The First Edition (November 3, 1971) Unix manual documented
the following options for <tt>ls</tt>, all of which are still available today:
<p>
<table>
<tr>
<td><tt>ls -l&nbsp;&nbsp;</tt></td>
<td>list in long format</td>
</tr>
<tr>
<td><tt>ls -t</tt></td>
<td>sort by time modified</td>
</tr>
<tr>
<td><tt>ls -a</tt></td>
<td>list everything, including names starting with `<tt>.</tt>'</td>
</tr>
<tr>
<td><tt>ls -s</tt></td>
<td>include the size of files in the listing</td>
</tr>
<tr>
<td><tt>ls -d</tt></td>
<td>list directories' names, not their contents</td>
</tr>
</table>
<p>
By the Fifth Edition (manual page dated March 20, 1974) the list of
options for <tt>ls</tt> had expanded to include:
<p>
<table>
<tr>
<td><tt>ls -r&nbsp;&nbsp;</tt></td>
<td>list in reverse order</td>
</tr>
<tr>
<td><tt>ls -u</tt></td>
<td>use access time, not modification time</td>
</tr>
<tr>
<td><tt>ls -i</tt></td>
<td>list i-number for each file</td>
</tr>
<tr>
<td><tt>ls -f</tt></td>
<td>don't sort the listing at all</td>
</tr>
</table>
<p>
The Sixth Edition (May, 1975) added one more:
<p>
<table>
<tr>
<td><tt>ls -g&nbsp;&nbsp;</tt></td>
<td>list group IDs in the long format listing</td>
</tr>
</table>
<p>
In May and August, 1977, Bill Joy made some modifications of his own to
<tt>ls</tt> at the University of California, Berkeley, which he
subsequently distributed as part of the First Berkeley Software
Distribution, 1BSD. The most dramatic difference with this version of
<tt>ls</tt> was that it listed files in multiple columns rather than
only listing one name per line. The options to control this new format
were:
<p>
<table>
<tr>
<td><tt>ls -1&nbsp;&nbsp;</tt></td>
<td>list one name per line (no columns)</td>
</tr>
<tr>
<td><tt>ls -c</tt></td>
<td>list in columns</td>
</tr>
<tr>
<td><tt>ls -x</tt></td>
<td>list in columns, but sort across, not down</td>
</tr>
<tr>
<td><tt>ls -q</tt></td>
<td>show control characters as `<tt>?</tt>'</td>
</tr>
<tr>
<td><tt>ls -m</tt></td>
<td>everything on one line, separated by commas</td>
</tr>
</table>
<p>
There was some controversy over whether it was appropriate to
include code to print in columns as an integral part of <tt>ls</tt>
or whether
instead the formatting into columns should be done by a separate program
into which the output of <tt>ls</tt> (or any other program) could be piped.
<p>
At the beginning of 1979, Bell Labs released Seventh Edition Unix. Its
version of <tt>ls</tt> did not incorporate the controversial changes,
and had one new option
that conflicted with a letter that Joy had also used:
<p>
<table>
<tr>
<td><tt>ls -c&nbsp;&nbsp;</tt></td>
<td>use inode change time, not modification time</td>
</tr>
</table>
<p>
A new Berkeley version of <tt>ls</tt>, dated August 26, 1980 and released with
4.0BSD, resolved the conflict by capitalizing the option to list in
columns: <tt>ls -C</tt>. It also added to what the manual was
by this time calling ``an unbelievable number of options:''
<p>
<table>
<tr>
<td><tt>ls -F&nbsp;&nbsp;</tt></td>
<td>mark directories with `<tt>/</tt>', programs with `<tt>*</tt>'</td>
</tr>
<tr>
<td><tt>ls -R</tt></td>
<td>recursively list subdirectories</td>
</tr>
<tr>
<td><tt>ls -b</tt></td>
<td>show control characters as their ASCII codes</td>
</tr>
</table>
<p>
Another revision in 4.2BSD (July 28, 1983) removed the <tt>-m</tt>,
<tt>-b</tt>, and <tt>-x</tt>
options -- but not before System V Release 2 had added all three of these
to its own repertoire of options.
They temporarily stayed alive there, but
none of the three survived POSIX standardization
so the 4.2BSD version of <tt>ls</tt> is essentially <tt>ls</tt>
as we know it today.
<!-- *** BEGIN copyright *** -->
<P> <hr> <P>
<H5 ALIGN=center>
Copyright &copy; 1999, Eric Fischer<BR>
Published in Issue 48 of <i>Linux Gazette</i>, December 1999</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<P> <HR> <P>
<!-- *** BEGIN navbar *** -->
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="dellomodarme.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../faq/index.html"><IMG ALT="[ Linux Gazette FAQ ]"
SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="fisher.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom ></A>
<!-- *** END navbar *** -->
</BODY></HTML>
<!--endcut ============================================================-->