Nuking Files Back to the Stone Age






Nuking Files Back to the Stone Age

You can also get rid of files by using the command the lazy typists call rm. To erase (delete, remove — it’s all the same thing) a file, type

rm budget.feb

If all goes well, UNIX reports nothing, and you see another prompt. Use ls to see whether the rm command worked and the file is gone.

 Warning  Watch out! Under most circumstances, you have no way to get a file back after you delete it.

To be safe, you can use the -i option to ask rm to ask you to confirm deletion of the file. This is a particularly good idea if you use wildcards to delete a group of files all at one time (see Chapter 7 for more info about wildcards). For example, if you type

rm -i last-years-budget

UNIX asks:

rm: remove `last-years-budget’

Press the y key to delete the file or the n key to leave it alone.

Big, big trouble

If you delete something really, really important and you will be called on to perform ritual seppuku if you can’t get it back, don’t give up hope. Your local UNIX guru should make things called backups on some regular basis. Backups contain copies of some or all of the files on the UNIX system. Your files may be among those on the backup. Go to the guru on bended knee and ask whether the file can be restored. If the file wasn’t backed up recently, you may get an older version of it, but hey — it’s better than the alternative.

Even before you get yourself into this kind of pickle, you may want to ask your UNIX expert to confirm that regular backups are made. Make sure that your important files are included in the backups. If no one is making regular backups, panic! This is not a safe situation. You had better talk to your system administrator about getting a backup system.

Good housekeeping

You should get rid of files you no longer use, for several reasons:

  • Having all kinds of files lying around becomes confusing, and remembering which ones are important is difficult.

  • Useless files take up disk space. Whoever is in charge of your UNIX system probably will bother you regularly to “take out the garbage,” that is, to get rid of unnecessary files and free up some disk space.

 Tip  On the other hand, making extra copies of files can be a good idea. If you have been working on a report for three weeks, making an extra copy every day or so isn’t a bad idea. That way, if you make some revisions that, in hindsight, are stupid, you can always go back to a previous revision.



 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows