Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Wish a script which would delete cache content and remove additional files which have been downloaded via the internet and saved voluntarily by the user and files any thing other than those used by the OS in linux.

Need a command which could make the execution of the above script possible before the shut down command is passed .


share|improve this question
No static content is kept in swap space, hence you cannot "clear" it. And what cache do you mean - a lot of systems use that term. – new123456 Jul 21 '11 at 22:22
While the data in swap is not always static, it is data that is written to disk, which opens the opportunity for discovery. That data in swap could be anything from emails to temp copies of files that were being edited. – Xenoactive Jul 22 '11 at 5:01

Look at the Secure Delete package from THC. It includes a command called sswap which can be used to wipe a swap device. Use the command in a shutdown script. You can find packages for most of the common Linux distros. Of course, you might also consider using encrypted swap devices. Otherwise, if your computer suddenly loses power, you lose the opportunity to cleanly wipe the swap device.

share|improve this answer
Encrypted swap is going to give you the most bang for your buck here - raw swap devices won't be accessible for forensic analysis from a running system unless an attacker can get root, which generally requires a reboot. rebooting loses the key, effectively making the contents of swap into random noise. That only leaves cold boot attacks to worry about, and there's nothing that can be done there except to reboot the system and allow it to come all the way back up, or to leave it powered down for sufficient time when leaving to make sure nobody can come behind you and extract data. – Stephanie Jul 22 '11 at 5:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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