Access Keys:
Skip to content (Access Key - 0)

How do I delete files?

Context

  • This answer relates to the Athena computing environment
  • The delete, undelete, purge, expunge, and lsdl commands are Athena specific and do not exist on normal Unix and Linux systems

Answer

The Athena computing environment supports a program called 'delete' for removing unwanted files. To delete a file or empty directory called 'foo' you would issue the following command:

delete foo

In order to delete a file whose name begins with a dash ("-") you need to use the dash option to 'delete'. For example, to delete a file named '-foo' you'd type:

delete  --  -foo

You may accidentally create files with other weird symbols or spaces in them. To remove these files you can often simply enclose the name in quotes. For files named "foo bar", "foo*bar", and "'foobar you could type:

delete "foo bar"
delete "foo*bar"
delete "'foobar"

Another technique that would work is to use the wildcard character "*" however you should be very careful when using it. Typing:

delete foo*  

...would remove the above examples, but it will also delete the files "foo" and "foolish" if they exist.

If you wish to simply rename these files you can use the command "mv". To rename the file "foo bar" to "foobar" type:

mv "foo bar"  foobar

The delete program does not actually remove files permanently. Instead, it marks them for deletion, and a system cleanup program purges deleted files that have been sitting around for more than three days. Therefore, if you accidentally delete a file and then realize that you want it back, you can get
it back by using the program "undelete" like this:

undelete  foo

The programs "expunge" and "purge" are used to actively remove deleted files from your Athena account permanently. The only reason you should have to use them is if you are over your quota allowance or close to it, since files that have been deleted but not yet permanently removed still count towards your quota.

The program "lsdel" allows you to list deleted files that have not yet been permanently removed.

For more information, please see the man pages for delete, undelete, expunge, purge and lsdel. For example, to see the man page for delete, type:

man  delete

NOTE: The delete package and associated commands are Athena-specific. The standard Unix utility for removing files is called "rm," and it exists on Athena in addition to delete. However, we recommend that you use delete rather than rm, since files that you rm accidentally cannot be recovered.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

July 29, 2016

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-unix olc-unix Delete
delete delete Delete
file file Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki