Breadcrumbs 
Learning >> Documentation >> File System >> Deleting files
 
Recent News
We're No 1!
We've reached the top! (Of Google!)
[ more ]
Firefox 3 Download Day
Firefox 3 has been officially released and is looking to set a world record for the most downloaded piece of software in 24hrs.
[ more ]
SSL Renewed
SSL cert has been renewed by the admin team.
[ more ]
Deleting Files
Deleting Files

rm [option] [file]

Most of the cleaning up in Linux is done with the "rm" command (there are a few other creative ways though!).

$ rm dodgy_nightclub_pic.jpg

This will remove the offending file.

$ rm -i pic1.jig pic2.jpg
rm: remove 'pic1.jig'? n
rm: remove 'pic2.jig'? n

Here we delete two files in one swoop. The '-i' option asks you to confirm you want to delete each of them. Enter 'y' for yes, 'n' for no.

You can also delete entire directory structures with the rm command.

$ rm -r say_bye_bye/

The '-r' means recursively remove all sub folders and all files of this directory.

This is the single most dangerous command in any UNIX based system (including Linux). Linux has no "Recycle Bin", it assumes you won't make any silly mistakes. We all make mistakes from time to time so if you have any important files in your account, we cannot over-emphasise how important it is to make backups. Linux makes it very easy to do backups, especially using the tar command. It is usually just one command to backup everything, and the amount you really need to backup is very little in size (e.g. mail, college work, your website). If it is low enough, you can even get the tar command to email you your backup at a different email address!

Finally lets talk about the very handy symbolic link.