Please enable JavaScript eh!

 ⌘ Web Mechanic ⌘ 

Bash Scripting


rm

remove

As with ALL bash commands, this requires your FULL attention.
Files deleted this way are NOT in your Trash so CANNOT be 'Put Back'.

This is beginning to stop making sense. (No, not the Talking Heads tune). Why do we use 'rmdir' if it doesn't delete a directory with something in it?

I agreee, this is a bit odd. rm is typically used to delete (remove) files - we'll cover this later. For now just nod your head, and read on.

rm actually deletes files AND directories, with a special option.

rm -r

This removes directories and all their files or subdirectories. The '-r' stands for recursive - a good reminder.

The directory named '4' on your Desktop should contain 2 subdirectories. Here's how we delete that whole tree.

rm -r 4

Since a directory is just a file, if there had been actual files in the directory, they would be deleted as well.

Note that it did not ask you 'Are you sure?'
Measure twice, cut once
cp | mv