rm
Delete files and folders.
SYNTAX
rm [options] file ...
unlink file
OPTIONS
-d Attempt to remove folders.
-f Attempt to remove the files without prompting for confirma-
tion, regardless of the file's permissions. If the file does
not exist, do not display a diagnostic message or modify the
exit status to reflect an error.
-i Request confirmation before attempting to remove each file.
-P Overwrite regular files before deleting them. Files are
overwritten three times, first with the byte pattern 0xff,
then 0x00, and then 0xff again, before they are deleted.
-R Remove the entire file hierarchy rooted in each file
argument. (implies the -d Delete folders).
If the -i
option is specified, the user is prompted for confirmation
before each directory's contents are processed (as well as
before the attempt is made to remove the directory). If the
user does not respond affirmatively, the file hierarchy
rooted in that directory is skipped.
-r Equivalent to -R.
-v Be verbose when deleting files, showing them as they are
removed.
-W Attempt to undelete the named files. Currently, this option
can only be used to recover files covered by whiteouts.
unlink Unlink a file, only one argument, which must not be a directory
may be supplied. Calls the unlink() function which removes the
link named by path from its directory and decrements the link count
of the file which was referenced by the link.
The rm utility removes symbolic links, not the files referenced by the links.
If an error occurs, rm exits with a value >0.
EXAMPLES Delete all .jpg files in the current folder rm *.jpg Delete the folder named "temp", and all its contents rm -R temp Delete a protected folder sudo rm -r NAME_OF_FOLDER_TO_DELETE
you will be prompted for your password. hit return
"The erase function in Disk Utility can erase an entire partition."
Related commands:
cp - Copy files
ls - List information about files
rmdir - Remove empty folder
DS_Store
- Hidden System Files
Equivalent BASH command:
rm - Delete Files