An introduction of the Terminal for Mac OS X
- cd - change directory
- ls - list the content of a directory
- pwd - parent working dir
- mkdir - create a new directory
- rm - Remove files and folders
- cp - Copy files and folders
- mv - Move files and folders
- ditto - Move files and folders (advanced)
Syntax: rm [-Options] <filename/directory>
Usage/Result: Remove a file or a folder.
|-d||Attempts to remove folders|
|-f||Attempts 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).|
|-i||Confirm each attempt to remove a file.|
|rm myimage.jpg||Attempts to remove the file called myimage.jpg in the current working dir.|
|rm /usr/local/myimage.jpg||Attempts to remove the file myimage.jpg i en annan mapp än den du för tillfället står i.|
|rm *.jpg||Attempts to remove all files that ends with .jpg.|
|rm -R temp||Attempts to remove the directory temp including all of it's eventual subtrees and files.|
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.