File: fischer.html

package info (click to toggle)
lg-issue49 1-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,280 kB
  • ctags: 255
  • sloc: makefile: 36; tcl: 19; sh: 15; perl: 1
file content (191 lines) | stat: -rw-r--r-- 7,253 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!--startcut  ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>A Brief History of the 'rm' and 'rmdir' commands LG #49</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->

<!-- *** BEGIN navbar *** -->
<A HREF="lg_toc49.html"><IMG ALT="[ Table of Contents ]" 
	SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../lg_frontpage.html"><IMG ALT="[ Front Page ]" 
	SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="bennet.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../lg_faq.html"><IMG ALT="[ Linux Gazette FAQ ]" 
	SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="lamb.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 'rm' and 'rmdir' commands</font></H1>
<H4>By <a href="mailto:enf@pobox.com">Eric Fischer</a></H4>
</center>
<P> <HR> <P>  

<!-- END header -->




<p>
Unlike many of the most basic Unix and Linux utilities,
the <tt>rm</tt> command's name is not actually older than Unix itself.
In Unix's predecessors, the Compatible Time Sharing System (CTSS) and Multics,
the command used to remove files was called <tt>delete</tt>,
which in Multics could optionally be abbreviated to <tt>dl</tt>.
In Unix, the name became <tt>rm</tt>, probably to reflect the
philosophical change from deleting files
to removing the directory entries that linked to them.

<p>

Also part of Unix by the time of its First Edition manual
(November 3, 1971) was the <tt>rmdir</tt> command to remove directories.
Today the <tt>rmdir</tt> command
just makes an <tt>rmdir()</tt> system call for each of its arguments
and reports any errors.
But in 1971 there was no
<tt>rmdir()</tt> system call, so the <tt>rmdir</tt> program
had to do all the work itself.
It would make sure the directory being removed
was empty and that its permissions were correct and
then remove the ``<tt>.</tt>'' and ``<tt>..</tt>'' special links
before unlinking the directory itself.
This situation persisted until 1983, when the introduction
of the new Fast File System in 4.2BSD made the creation and removal
of directories the responsibility of the kernel.

<p>

The 1971 version of <tt>rm</tt> did not have any of the options
that current versions have.
It was also willing to remove read-only files, though the
manual noted that it ``probably should ask.''
It was changed so that it did ask (as CTSS's <tt>delete</tt> had been
in 1965) in a new version whose
manual page was dated January 20, 1973, and which included these options:

<p>
<table>
  <tr>
    <td><tt>rm -f&nbsp;&nbsp;</tt></td>
    <td>don't ask before removing read-only files</td>
  </tr>
  <tr>
    <td><tt>rm -r&nbsp;&nbsp;</tt></td>
    <td>recursively remove subdirectories</td>
  </tr>
</table>

<p>

The way the
<tt>rm -r</tt>
option was implemented at that time,
when <tt>rm</tt> encountered a directory among the files it was
removing, it would <tt>cd</tt> (then called <tt>chdir</tt>)
to that directory and
start another instance of <tt>rm&nbsp;-r&nbsp;*</tt> to remove its contents.
A version which did the recursion within a single <tt>rm</tt> process
appeared in the Seventh Edition of Unix in 1979,
which also introduced a new option:

<p>
<table>
  <tr>
    <td><tt>rm -i&nbsp;&nbsp;</tt></td>
    <td>ask whether each file or directory should be removed</td>
  </tr>
</table>

<p>

This made it possible to type <tt>rm&nbsp;-i&nbsp;*</tt> to
interactively remove selected files from a directory, including ones whose
names had somehow been mangled to the point that they had become untypable.
This feature had actually been needed much earlier, but prior
to the Seventh Edition it had been done by a separate, now long abandoned
program called <tt>dsw</tt>.

<p>

The name of <tt>dsw</tt> was more mysterious than any other command,
even in this operating system known for its obscure names.
The Sixth Edition manual taunted the curious with
the note that ``the name
<i>dsw</i> is a carryover from the ancient past.  Its etymology is
amusing.''  The First Edition had added ``...&nbsp;but the name is
nonetheless ill-advised,'' but this disappeared from later manuals.

<p>

The speculation about what the name of <tt>dsw</tt> might really mean
(delete s--t work?  <i>do svidaniya</i>?) was put to an end
when Dennis Ritchie revealed in a 1981 Usenet posting
that the name had originally meant ``delete from switches.''
This was a reference to the toggle switches on the front panel of
the PDP-7 computer that the earliest version of Unix ran on.
(Some later hardware also had console switches, and the
Third through Sixth Editions had a <tt>getcsw()</tt> system
call that programs could use to find out what they were set to.)

<p>

To use the original <tt>dsw</tt>, you would set the front panel
switches to a number and run <tt>dsw</tt>, which would then
read that number of entries from the current directory, print on the terminal
the name of the last one it had read, and crash itself, leaving a core dump.
You could then, if you wanted, remove the file it had named
by reexecuting the <tt>core</tt> file.
When this awful user interface was replaced by a more reasonable one,
the name remained until the entire program was replaced by <tt>rm&nbsp;-i</tt>.

<p>

At that point, the evolution of the <tt>rm</tt> command came, for
the most part, to an end.
A slightly altered version, dated April 1, 1981 and distributed with
4.2BSD, introduced an option terminator ``<tt>-</tt>'' to make
it easier to remove files whose names started with a dash.
For consistency with other commands,
the POSIX standard changed this to ``<tt>--</tt>''
and made the capitalized option ``<tt>-R</tt>''
also remove directories recursively.




<!-- *** BEGIN copyright *** -->
<P> <hr> <P> 
<H5 ALIGN=center>

Copyright &copy; 2000, Eric Fischer<BR> 
Published in Issue 49 of <i>Linux Gazette</i>, January 2000</H5>
<!-- *** END copyright *** -->

<!--startcut ==========================================================-->
<P> <HR> <P>
<!-- *** BEGIN navbar *** -->
<A HREF="lg_toc49.html"><IMG ALT="[ Table of Contents ]" 
	SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../lg_frontpage.html"><IMG ALT="[ Front Page ]" 
	SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="bennet.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../lg_faq.html"><IMG ALT="[ Linux Gazette FAQ ]" 
	SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="lamb.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom  ></A>
<!-- *** END navbar *** -->
</BODY></HTML>
<!--endcut ============================================================-->