Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Deleting Files

July 19, 1998

The "rm" utility is used to delete files. As a warning, in UNIX there is no easy way to recover a deleted file unless you have it saved in a backup. So be very careful when using this command.

rm follows the standard form of:

rm [options] space_delimted_filelist

The rm utility has three extremely useful options

Option Explanation
-r Deletes in a recursive manner including whole directories. Obviously you should be extremely careful with this option.
-i Specifies that you wish to reconfirm each file before it is deleted. This is a particularly useful option if you are deleting using -r or with wild cards.
-f Bypasses the prompt when deleting against permission.
-- Specifies that the options are over if necessary

[rm Example]

It cannot be said too forcefully that you should be extremely careful when using wildcards with "rm". In particular, you should try not to use the rm utility like "rm *' or "rm -r *" unless you really, really, really know what you are doing AND you have already backed up the data you are deleting. If you delete files by mistake, and you have not made your own backup, your only recourse is to hope that your system administrator has backed up the system for you.

One deeply evil mistake is when you mean to type "rm *.bak" and instead you type "rm * .bak". Notice the accidental space between the "*" and the ".bak". If you do this, all your files will be erased and you will get an error message saying that the file .bak does not exist. Believe me, this is easy to do...I have done it twice to my great dismay. So be very careful. It is always safer to use the "-i" option when you use rm's with wild cards.

Additional Resources:

Moving and Renaming Files
Introduction to UNIX for Web Developers | Table of Contents
Directories


Up to => Home / Internet / UNIX / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers