Mac-terminal.com

Mac-Terminal.com

An introduction of the Terminal for Mac OS X

rm

Syntax: rm [-Options] <filename/directory>

Usage/Result: Remove a file or a folder.

Options:

-dAttempts to remove folders
-fAttempts to remove the files without prompting for confirmation or error messages. (For instance if you don't have permission to remove a file, or if the file doesn't exists).
-iConfirm each attempt to remove a file.

Exempel

rm myimage.jpgAttempts to remove the file called myimage.jpg in the current working dir.
rm /usr/local/myimage.jpgAttempts to remove the file myimage.jpg i en annan mapp än den du för tillfället står i.
rm *.jpgAttempts to remove all files that ends with .jpg.
rm -R tempAttempts to remove the directory temp including all of it's eventual subtrees and files.

Quick tip: Sometimes you might not be able to perform a certain command or task from the Terminal. This might be because you don't have the right permission to do so. When that happens you can try to add the word "sudo" in the beginning of the line.
Sudo is an abbreviation of superuser do and means that you want to execute the following command as a user with extended permissions, most often as an Administrator. When using "sudo" you sometimes need to enter the password of the root account.
Learn more about sudo.