Removing files and directories
- The key difference between deleting something from the command line and using the graphical file browser is that in the first case the file vanishes immediately, but in the second it will be stored for a while in the Rubbish Bin and can be retrieved.
- So these can be very destructiv commands, and they should be used carefully and not in a rush.
- To remove a file or files, use the rm command followed by the name of the file(s) you wish to delete.
rm file2 file3 file4
- Removing directories cna be done with rmdir, but this is a conservative comamnd as it will refuse to delete if the directory has any files.
- A much more powerful command is
rm –r fulldir
- This will wipe out the directory empty or not.
- With this command, you need to be 100% confident that you will never make a mistake
- Move into the testdir directory.
- Delete mythirdfile.txt using the command line
- Delete myfourthfile.txt using the graphical file browser. Is the files now sitting in the Rubbish Bin?
- Back on the command line, move back into your Home directory.
- Then delete myfirstfile.txt from testdir without moving back to the testdir directory.