Comandos de la terminal/rm
< Comandos de la terminal
Ir a la navegación
Ir a la búsqueda
Revisión del 19:26 12 abr 2014 de Rrc (discusión | contribuciones)
rm
[rrc@pridd ComandosDeLaTerminal]$ rm --help
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).
-f, --force ignore nonexistent files and arguments, never prompt
-i prompt before every removal
-I prompt once before removing more than three files, or
when removing recursively. Less intrusive than -i,
while still giving protection against most mistakes
--interactive[=WHEN] prompt according to WHEN: never, once (-I), or
always (-i). Without WHEN, prompt always
--one-file-system when removing a hierarchy recursively, skip any
directory that is on a file system different from
that of the corresponding command line argument
--no-preserve-root do not treat '/' specially
--preserve-root do not remove '/' (default)
-r, -R, --recursive remove directories and their contents recursively
-d, --dir remove empty directories
-v, --verbose explain what is being done
--help display this help and exit
--version output version information and exit
By default, rm does not remove directories. Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.
To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
rm -- -foo
rm ./-foo
Note that if you use rm to remove a file, it might be possible to recover
some of its contents, given sufficient expertise and/or time. For greater
assurance that the contents are truly unrecoverable, consider using shred.
Report rm bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'rm invocation'
[rrc@pridd ComandosDeLaTerminal]$ rm --version
rm (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.
[rrc@pridd ComandosDeLaTerminal]$ alias rm
alias rm='rm -i'
[rrc@pridd ComandosDeLaTerminal]$ rm typescript
rm: remove regular file ‘typescript’? n
[rrc@pridd ComandosDeLaTerminal]$ ls -al typescript
-rwxr-xr-x 1 rrc rrc 1359 Jan 18 15:41 typescript*
[rrc@pridd ComandosDeLaTerminal]$ rm -f typescript
[rrc@pridd ComandosDeLaTerminal]$ ls -al typescript
ls: cannot access typescript: No such file or directory
[rrc@pridd ComandosDeLaTerminal]$ ls -al UniqSortEjemplo
-rw-r--r-- 1 rrc rrc 48 Apr 1 16:56 UniqSortEjemplo
[rrc@pridd ComandosDeLaTerminal]$ unalias rm
[rrc@pridd ComandosDeLaTerminal]$ alias rm
bash: alias: rm: not found
[rrc@pridd ComandosDeLaTerminal]$ rm UniqSortEjemplo
[rrc@pridd ComandosDeLaTerminal]$ ls -al UniqSortEjemplo
ls: cannot access UniqSortEjemplo: No such file or directory
[rrc@pridd ComandosDeLaTerminal]$ rm C1/C2/C3/C4/C5/C6/
rm: cannot remove ‘C1/C2/C3/C4/C5/C6/’: Is a directory
[rrc@pridd ComandosDeLaTerminal]$ rm -d C1/C2/C3/C4/C5/C6/
[rrc@pridd ComandosDeLaTerminal]$ ls -al C1/C2/C3/C4/C5/C6/
ls: cannot access C1/C2/C3/C4/C5/C6/: No such file or directory
[rrc@pridd ComandosDeLaTerminal]$ touch C1/C2/C3/C4/C5/Archivo
[rrc@pridd ComandosDeLaTerminal]$ rm C1/C2/C3/C4/C5
rm: cannot remove ‘C1/C2/C3/C4/C5’: Is a directory
[rrc@pridd ComandosDeLaTerminal]$ rm -d C1/C2/C3/C4/C5
rm: cannot remove ‘C1/C2/C3/C4/C5’: Directory not empty
[rrc@pridd ComandosDeLaTerminal]$ rm -r C1/C2/C3/C4/C5
[rrc@pridd ComandosDeLaTerminal]$ ls -al C1/C2/C3/C4/C5
ls: cannot access C1/C2/C3/C4/C5: No such file or directory
[rrc@pridd ComandosDeLaTerminal]$ rm -df C1
rm: cannot remove ‘C1’: Directory not empty
rrc@pridd ComandosDeLaTerminal]$ rm -r C1
rm: descend into directory ‘C1’? y
rm: remove directory ‘C1/C2’? y
rm: remove directory ‘C1’? y
[rrc@pridd ComandosDeLaTerminal]$ ls -alR C11
C11:
total 12
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:06 ./
drwxrwxr-x 11 rrc rrc 4096 Apr 12 14:21 ../
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:06 C12/
C11/C12:
total 12
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:06 ./
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:06 ../
drwxr-x--- 2 rrc rrc 4096 Mar 22 16:06 C13/
C11/C12/C13:
total 8
drwxr-x--- 2 rrc rrc 4096 Mar 22 16:06 ./
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:06 ../
[rrc@pridd ComandosDeLaTerminal]$ rm -rf C11
[rrc@pridd ComandosDeLaTerminal]$ ls -alR C11
ls: cannot access C11: No such file or directory
[rrc@pridd ComandosDeLaTerminal]$ rm -rvf richard
removed ‘richard/evolution.es.html’
removed ‘richard/RichardSleeve.es.html’
removed ‘richard/robots.txt’
removed ‘richard/index.html’
removed ‘richard/images/valid-xhtml11.png’
removed ‘richard/images/valid-xhtml10.png’
removed directory: ‘richard/images’
removed ‘richard/evolution.html’
removed ‘richard/index.es.html’
removed ‘richard/RichardSleeve.html’
removed directory: ‘richard’