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:

rm man page - Apple.com
cp - Copy files
ls - List information about files
rmdir - Remove empty folder
DS_Store - Hidden system files used by finder
HT1526 - You can't empty the Trash or move a file to the Trash



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved