Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How can I securely erase a hard drive?
How to delete file(s) in secure manner?

I've got an older computer with an 80 GB hard drive. I'm trying to keep the hard drive as clear as possible and delete any downloaded files that I no longer need. I was just wondering, if I delete a file (which sends it to the trash bin) and then empty the trash bin, does that completely delete the file off the hard drive? If not, is there a good way to clean up the hard drive from time to time without erasing necessary programs?

share|improve this question

marked as duplicate by Uri Herrera, gertvdijk, Eliah Kagan, Luis Alvarado, Tom Brossman Jan 2 '13 at 8:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

@UriHerrera Not really a dupe of that question as that concerns complete devices. However answers there might apply to individual files too. Moreover, I think OP is not too concerned about security in this, but just trying to save disk space. – gertvdijk Jan 2 '13 at 3:30
Are you asking how to make sure the data can not be recovered even by forensic methods, or you just want to make sure the space is freed? – psusi Jan 2 '13 at 3:42

If my understanding is correct, when you empty the trash can all the files in it are completely deleted.

If you want to make sure that a file is deleted, you can delete files using the rm command, although this is dangerous, as you can easily break your system or delete many files if you accidentally mistype this command.

If you want more info on rm, look on its manpage.

share|improve this answer
Deleted as in unlinked. With data recovery applications it is still possible to retrieve (parts of) their content, for a fair amounts of cases. – gertvdijk Jan 2 '13 at 3:32
Also, if hardlinks exist, the (contents of) file is not removed at all using rm, but just one reference to it is removed. – gertvdijk Jan 2 '13 at 10:18
That's true, I suppose the way to technically completely remove something would be to use a command like shred, although the manpage says that shred doesn't work well on some hard drive formats, including Ext3. Likewise, shred should be used with the utmost care. – DaimyoKirby Jan 2 '13 at 12:54

Yes. The answer to your question is yes. If you delete the files from the Trash , then the files no longer occupy a space in your HDD.

If you want to make a safe cleaning to the Operating System , then you can apply the commands below from time to time.

sudo apt-get --purge autoremove
sudo apt-get clean
sudo apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')

1st command will delete all unwanted packages.

2nd command will clean up the apt-cache

3rd command will delete unwanted files (e.g packages you have deleted and configuration files are still in system)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.