Print this page
4815 Want rm support for -v option
4816 rm does not print error messages when -f is used
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/rm.1
+++ new/usr/src/man/man1/rm.1
1 1 '\" te
2 2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
3 3 .\" Copyright 1989 AT&T
4 4 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
5 5 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
6 +.\" Copyright 2014 Andrew Stormont.
6 7 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
7 8 .\" http://www.opengroup.org/bookstore/.
8 9 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 10 .\" This notice shall appear on any product containing this material.
10 11 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
11 12 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
12 13 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 -.TH RM 1 "Nov 20, 2007"
14 +.TH RM 1 "Apr 30, 2014"
14 15 .SH NAME
15 16 rm, rmdir \- remove directory entries
16 17 .SH SYNOPSIS
17 18 .LP
18 19 .nf
19 -\fB/usr/bin/rm\fR [\fB-f\fR] [\fB-i\fR] \fIfile\fR...
20 +\fB/usr/bin/rm\fR [\fB-f\fR] [\fB-i\fR] [\fB-v\fR] \fIfile\fR...
20 21 .fi
21 22
22 23 .LP
23 24 .nf
24 -\fB/usr/bin/rm\fR \fB-rR\fR [\fB-f\fR] [\fB-i\fR] \fIdirname\fR... [\fIfile\fR]...
25 -.fi
26 -
27 -.LP
28 -.nf
29 -\fB/usr/xpg4/bin/rm\fR [\fB-fiRr\fR] \fIfile\fR...
25 +\fB/usr/bin/rm\fR \fB-rR\fR [\fB-f\fR] [\fB-i\fR] [\fB-v\fR] \fIdirname\fR... [\fIfile\fR]...
30 26 .fi
31 27
32 28 .LP
33 29 .nf
34 30 \fB/usr/bin/rmdir\fR [\fB-ps\fR] \fIdirname\fR...
35 31 .fi
36 32
37 33 .SS "ksh93"
38 34 .LP
39 35 .nf
40 36 \fB/usr/bin/rmdir\fR [\fB-eps\fR] \fIdirname\fR...
41 37 .fi
42 38
43 39 .SH DESCRIPTION
44 -.SS "/usr/bin/rm /usr/xpg4/bin/rm"
40 +.SS "/usr/bin/rm"
45 41 .sp
46 42 .LP
47 43 The \fBrm\fR utility removes the directory entry specified by each \fIfile\fR
48 44 argument. If a file has no write permission and the standard input is a
49 45 terminal, the full set of permissions (in octal) for the file are printed
50 46 followed by a question mark. This is a prompt for confirmation. If the answer
51 47 is affirmative, the file is deleted, otherwise the file remains.
52 48 .sp
53 49 .LP
54 50 If \fIfile\fR is a symbolic link, the link is removed, but the file or
55 51 directory to which it refers is not deleted. Users do not need write permission
56 52 to remove a symbolic link, provided they have write permissions in the
57 53 directory.
58 54 .sp
59 55 .LP
60 56 If multiple \fIfile\fRs are specified and removal of a \fIfile\fR fails for any
61 57 reason, \fBrm\fR writes a diagnostic message to standard error, do nothing more
62 58 to the current \fIfile\fR, and go on to any remaining \fIfile\fRs.
63 59 .sp
64 60 .LP
65 61 If the standard input is not a terminal, the utility operates as if the
66 62 \fB-f\fR option is in effect.
67 63 .SS "/usr/bin/rmdir"
68 64 .sp
69 65 .LP
70 66 The \fBrmdir\fR utility removes the directory entry specified by each
71 67 \fIdirname\fR operand, which must refer to an empty directory.
72 68 .sp
73 69 .LP
74 70 Directories are processed in the order specified. If a directory and a
75 71 subdirectory of that directory are specified in a single invocation of
76 72 \fBrmdir\fR, the subdirectory must be specified before the parent directory so
77 73 that the parent directory is empty when \fBrmdir\fR tries to remove it.
78 74 .SS "ksh93"
79 75 .sp
80 76 .LP
81 77 The \fBrmdir\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
82 78 \fB/usr/bin\fR paths. It is invoked when \fBrmdir\fR is executed without a
83 79 pathname prefix and the pathname search finds a \fB/bin/rmdir\fR or
84 80 \fB/usr/bin/rmdir\fR executable.
↓ open down ↓ |
30 lines elided |
↑ open up ↑ |
85 81 .sp
86 82 .LP
87 83 \fBrmdir\fR deletes each given directory. The directory must be empty and
88 84 contain no entries other than \fB\&.\fR or \fB\&..\fR. If a directory and a
89 85 subdirectory of that directory are specified as operands, the subdirectory must
90 86 be specified before the parent, so that the parent directory is empty when
91 87 \fBrmdir\fR attempts to remove it.
92 88 .SH OPTIONS
93 89 .sp
94 90 .LP
95 -The following options are supported for \fB/usr/bin/rm\fR and
96 -\fB/usr/xpg4/bin/rm\fR:
91 +The following options are supported for \fB/usr/bin/rm\fR only:
97 92 .sp
98 93 .ne 2
99 94 .na
100 95 \fB\fB-r\fR\fR
101 96 .ad
102 97 .RS 6n
103 98 Recursively removes directories and subdirectories in the argument list. The
104 99 directory is emptied of files and removed. The user is normally prompted for
105 100 removal of any write-protected files which the directory contains. The
106 101 write-protected files are removed without prompting, however, if the \fB-f\fR
107 102 option is used, or if the standard input is not a terminal and the \fB-i\fR
108 103 option is not used.
109 104 .sp
110 105 Symbolic links that are encountered with this option is not traversed.
111 106 .sp
112 107 If the removal of a non-empty, write-protected directory is attempted, the
113 108 utility always fails (even if the \fB-f\fR option is used), resulting in an
114 109 error message.
115 110 .RE
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
116 111
117 112 .sp
118 113 .ne 2
119 114 .na
120 115 \fB\fB-R\fR\fR
121 116 .ad
122 117 .RS 6n
123 118 Same as \fB-r\fR option.
124 119 .RE
125 120
126 -.SS "/usr/bin/rm"
127 -.sp
128 -.LP
129 -The following options are supported for \fB/usr/bin/rm\fR only:
130 -.sp
131 -.ne 2
132 -.na
133 -\fB\fB-f\fR\fR
134 -.ad
135 -.RS 6n
136 -Removes all files (whether write-protected or not) in a directory without
137 -prompting the user. In a write-protected directory, however, files are never
138 -removed (whatever their permissions are), but no messages are displayed. If the
139 -removal of a write-protected directory is attempted, this option does not
140 -suppress an error message.
141 -.RE
142 -
143 121 .sp
144 122 .ne 2
145 123 .na
146 -\fB\fB-i\fR\fR
124 +\fB\fB-v\fR\fR
147 125 .ad
148 126 .RS 6n
149 -Interactive. With this option, \fBrm\fR prompts for confirmation before
150 -removing any files. It overrides the \fB-f\fR option and remains in effect even
151 -if the standard input is not a terminal.
127 +Print out the name of files and directories removed.
152 128 .RE
153 129
154 -.SS "/usr/xpg4/bin/rm"
130 +.SS "/usr/bin/rm"
155 131 .sp
156 132 .LP
157 -The following options are supported for \fB/usr/xpg4/bin/rm\fR only:
133 +The following options are supported for \fB/usr/bin/rm\fR only:
158 134 .sp
159 135 .ne 2
160 136 .na
161 137 \fB\fB-f\fR\fR
162 138 .ad
163 139 .RS 6n
164 -Does not prompt for confirmation. Does not write diagnostic messages or modify
165 -the exit status in the case of non-existent operands. Any previous occurrences
166 -of the \fB-i\fR option is ignored.
140 +Removes all files (whether write-protected or not) in a directory without
141 +prompting the user.
167 142 .RE
168 143
169 144 .sp
170 145 .ne 2
171 146 .na
172 147 \fB\fB-i\fR\fR
173 148 .ad
174 149 .RS 6n
175 -Prompts for confirmation. Any occurrences of the \fB-f\fR option is ignored.
150 +Interactive. With this option, \fBrm\fR prompts for confirmation before
151 +removing any files. It overrides the \fB-f\fR option and remains in effect even
152 +if the standard input is not a terminal.
176 153 .RE
177 154
178 155 .SS "/usr/bin/rmdir"
179 156 .sp
180 157 .LP
181 158 The following options are supported for \fB/usr/bin/rmdir\fR only:
182 159 .sp
183 160 .ne 2
184 161 .na
185 162 \fB\fB-p\fR\fR
186 163 .ad
187 164 .RS 6n
188 165 Allows users to remove the directory \fIdirname\fR and its parent directories
189 166 which become empty. A message is printed to standard error if all or part of
190 167 the path could not be removed.
191 168 .RE
192 169
193 170 .sp
194 171 .ne 2
195 172 .na
196 173 \fB\fB-s\fR\fR
197 174 .ad
198 175 .RS 6n
199 176 Suppresses the message printed on the standard error when \fB-p\fR is in
200 177 effect.
201 178 .RE
202 179
203 180 .SS "ksh93"
204 181 .sp
205 182 .LP
206 183 The following options are supported for the \fBrmdir\fR built-in for
207 184 \fBksh93\fR:
208 185 .sp
209 186 .ne 2
210 187 .na
211 188 \fB\fB-e\fR\fR
212 189 .ad
213 190 .br
214 191 .na
215 192 \fB\fB--ignore-fail-on-non-empty\fR\fR
216 193 .ad
217 194 .RS 30n
218 195 Ignore each non-empty directory failure.
219 196 .RE
220 197
221 198 .sp
222 199 .ne 2
223 200 .na
224 201 \fB\fB-p\fR\fR
225 202 .ad
226 203 .br
227 204 .na
228 205 \fB\fB--parents\fR\fR
229 206 .ad
230 207 .RS 30n
231 208 Remove each explicit directory argument directory that becomes empty after its
232 209 child directories are removed.
233 210 .RE
234 211
235 212 .sp
236 213 .ne 2
237 214 .na
238 215 \fB\fB-s\fR\fR
239 216 .ad
240 217 .br
241 218 .na
242 219 \fB\fB--suppress\fR\fR
243 220 .ad
244 221 .RS 30n
245 222 Suppress the message printed on the standard error when \fB-p\fR is in effect.
246 223 .RE
247 224
248 225 .SH OPERANDS
249 226 .sp
250 227 .LP
251 228 The following operands are supported:
252 229 .sp
253 230 .ne 2
254 231 .na
255 232 \fB\fIfile\fR\fR
256 233 .ad
257 234 .RS 11n
258 235 Specifies the pathname of a directory entry to be removed.
259 236 .RE
260 237
261 238 .sp
262 239 .ne 2
263 240 .na
264 241 \fB\fIdirname\fR\fR
265 242 .ad
266 243 .RS 11n
267 244 Specifies the pathname of an empty directory to be removed.
268 245 .RE
269 246
↓ open down ↓ |
84 lines elided |
↑ open up ↑ |
270 247 .SH USAGE
271 248 .sp
272 249 .LP
273 250 See \fBlargefile\fR(5) for the description of the behavior of \fBrm\fR and
274 251 \fBrmdir\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
275 252 bytes).
276 253 .SH EXAMPLES
277 254 .sp
278 255 .LP
279 256 The following examples are valid for the commands shown.
280 -.SS "/usr/bin/rm, /usr/xpg4/bin/rm"
257 +.SS "/usr/bin/rm"
281 258 .LP
282 259 \fBExample 1 \fRRemoving Directories
283 260 .sp
284 261 .LP
285 262 The following command removes the directory entries \fBa.out\fR and \fBcore\fR:
286 263
287 264 .sp
288 265 .in +2
289 266 .nf
290 267 example% \fBrm a.out core\fR
291 268 .fi
292 269 .in -2
293 270 .sp
294 271
295 272 .LP
296 273 \fBExample 2 \fRRemoving a Directory without Prompting
297 274 .sp
298 275 .LP
299 276 The following command removes the directory \fBjunk\fR and all its contents,
300 277 without prompting:
301 278
302 279 .sp
303 280 .in +2
304 281 .nf
305 282 example% \fBrm -rf junk\fR
306 283 .fi
307 284 .in -2
308 285 .sp
309 286
310 287 .SS "/usr/bin/rmdir"
311 288 .LP
312 289 \fBExample 3 \fRRemoving Empty Directories
313 290 .sp
314 291 .LP
315 292 If a directory \fBa\fR in the current directory is empty, except that it
316 293 contains a directory \fBb\fR, and \fBa/b\fR is empty except that it contains a
317 294 directory \fBc\fR, the following command removes all three directories:
318 295
319 296 .sp
320 297 .in +2
321 298 .nf
322 299 example% \fBrmdir -p a/b/c\fR
323 300 .fi
324 301 .in -2
325 302 .sp
326 303
327 304 .SH ENVIRONMENT VARIABLES
328 305 .sp
329 306 .LP
330 307 See \fBenviron\fR(5) for descriptions of the following environment variables
331 308 that affect the execution of \fBrm\fR and \fBrmdir\fR: \fBLANG\fR,
332 309 \fBLC_ALL\fR, \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and
333 310 \fBNLSPATH\fR.
334 311 .sp
335 312 .LP
336 313 Affirmative responses are processed using the extended regular expression
337 314 defined for the \fByesexpr\fR keyword in the \fBLC_MESSAGES\fR category of the
338 315 user's locale. The locale specified in the \fBLC_COLLATE\fR category defines
339 316 the behavior of ranges, equivalence classes, and multi-character collating
340 317 elements used in the expression defined for \fByesexpr\fR. The locale specified
341 318 in \fBLC_CTYPE\fR determines the locale for interpretation of sequences of
342 319 bytes of text data a characters, the behavior of character classes used in the
343 320 expression defined for the \fByesexpr\fR. See \fBlocale\fR(5).
344 321 .SH EXIT STATUS
345 322 .sp
346 323 .LP
347 324 The following exit values are returned:
348 325 .sp
349 326 .ne 2
350 327 .na
351 328 \fB\fB0\fR\fR
352 329 .ad
353 330 .RS 6n
354 331 If the \fB-f\fR option was not specified, all the named directory entries were
355 332 removed; otherwise, all the existing named directory entries were removed.
356 333 .RE
357 334
358 335 .sp
359 336 .ne 2
360 337 .na
361 338 \fB\fB>0\fR\fR
362 339 .ad
363 340 .RS 6n
364 341 An error occurred.
365 342 .RE
366 343
367 344 .SS "ksh93"
368 345 .sp
369 346 .LP
370 347 The following exit values are returned:
371 348 .sp
372 349 .ne 2
373 350 .na
374 351 \fB\fB0\fR\fR
375 352 .ad
376 353 .RS 6n
377 354 Successful completion. All directories deleted successfully.
378 355 .RE
379 356
380 357 .sp
381 358 .ne 2
382 359 .na
383 360 \fB\fB>0\fR\fR
384 361 .ad
385 362 .RS 6n
386 363 An error occurred. One or more directories could not be deleted.
387 364 .RE
388 365
389 366 .SH ATTRIBUTES
390 367 .sp
391 368 .LP
392 369 See \fBattributes\fR(5) for descriptions of the following attributes:
393 370 .SS "/usr/bin/rm, /usr/bin/rmdir"
394 371 .sp
395 372
↓ open down ↓ |
105 lines elided |
↑ open up ↑ |
396 373 .sp
397 374 .TS
398 375 box;
399 376 c | c
400 377 l | l .
401 378 ATTRIBUTE TYPE ATTRIBUTE VALUE
402 379 _
403 380 CSI Enabled
404 381 .TE
405 382
406 -.SS "/usr/xpg4/bin/rm"
407 -.sp
408 -
409 -.sp
410 -.TS
411 -box;
412 -c | c
413 -l | l .
414 -ATTRIBUTE TYPE ATTRIBUTE VALUE
415 -_
416 -CSI Enabled
417 -_
418 -Interface Stability Committed
419 -_
420 -Standard See \fBstandards\fR(5).
421 -.TE
422 -
423 383 .SS "ksh93"
424 384 .sp
425 385
426 386 .sp
427 387 .TS
428 388 box;
429 389 c | c
430 390 l | l .
431 391 ATTRIBUTE TYPE ATTRIBUTE VALUE
432 392 _
433 393 Interface Stability See below.
434 394 .TE
435 395
436 396 .sp
437 397 .LP
438 398 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
439 399 The built-in interfaces are Uncommitted.
440 400 .SH SEE ALSO
441 401 .sp
442 402 .LP
443 403 \fBksh93\fR(1), \fBrmdir\fR(2), \fBrmdir\fR(2), \fBunlink\fR(2),
444 404 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
445 405 .SH DIAGNOSTICS
446 406 .sp
447 407 .LP
448 408 All messages are generally self-explanatory.
449 409 .sp
450 410 .LP
451 411 It is forbidden to remove the files "\fB\&.\fR" and "\fB\&..\fR" in order to
452 412 avoid the consequences of inadvertently doing something like the following:
453 413 .sp
454 414 .in +2
455 415 .nf
456 416 example% \fBrm -r .*\fR
457 417 .fi
458 418 .in -2
459 419 .sp
460 420
461 421 .sp
462 422 .LP
463 423 It is forbidden to remove the file "\fB/\fR" in order to avoid the consequences
464 424 of inadvertently doing something like:
465 425 .sp
466 426 .in +2
467 427 .nf
468 428 example% \fBrm -rf $x/$y\fR
469 429 .fi
470 430 .in -2
471 431 .sp
472 432
473 433 .sp
474 434 .LP
475 435 or
476 436 .sp
477 437 .in +2
478 438 .nf
479 439 example% \fBrm -rf /$y\fR
480 440 .fi
481 441 .in -2
482 442 .sp
483 443
484 444 .sp
485 445 .LP
486 446 when \fB$x\fR and \fB$y\fR expand to empty strings.
487 447 .SH NOTES
488 448 .sp
489 449 .LP
490 450 A \fB\(mi\fR permits the user to mark explicitly the end of any command line
491 451 options, allowing \fBrm\fR to recognize file arguments that begin with a
492 452 \fB\(mi\fR\&. As an aid to BSD migration, \fBrm\fR accepts \fB\(mi\|\(mi\fR as
493 453 a synonym for \fB\(mi\fR\&. This migration aid may disappear in a future
494 454 release. If a \fB\(mi\|\(mi\fR and a \fB\(mi\fR both appear on the same command
495 455 line, the second is interpreted as a file.
↓ open down ↓ |
63 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX