| Index: > A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|
|||||
The rm command in the Unix operating system is used to remove files from the file system. It is similar to the del command in DOS.
Its usage is considered potentially more dangerous than equivalents in other operating systems because of the way Unix and Unix-like systems parse wildcards and names of special directories and in its non-verbose actions. A classic example, which deletes all files in a directory instead of the files intended:
$ rm * .o rm: cannot remove `.o': No such file or directoryTo remove a file whose name starts with a `-', for example `-foo', use one of these commands:
rm -- -foo rm ./-fooNote that if you use rm to remove a file, it is usually possible to recover the contents of that file since rm does not remove it from the Hard disk. it simply removes the filesystems link to it. If you want more assurance that the contents are truly unrecoverable, consider using shred.
In practice, to allow for the recovery of rm'd files, don't use rm itself. Create an alias such as remove which moves the files to a local "trash" file so you can go there and recover files you accidentally removed.
Unix programs