Removing all swap files?

Many programs have created a huge amount of swap files. They annoy me because some of them contain confidential information. How can I deal with them? Is this command a good idea:

find . -iname "*swp*" -exec rm '{}' \;

      

How do good programs handle their swap files?

0


a source to share


3 answers


If files "annoy" you because they contain confidential information, you should know that simply deleting files using a command rm

does not actually delete the data on your hard drive.

I'm not sure where your swap files are or what application is creating them. Usually, the paging files are created by the operating system in a specially designated folder. For example, on my Mac:

$ ls /private/var/vm/
-rw------T  1 root  wheel  4294967296 Mar 15 19:41 sleepimage
-rw-------  1 root  wheel    67108864 Mar 15 21:10 swapfile0
$ 

      

If you want to remove information in the paging files, you really need to overwrite them. You can do it with "dd", but you'd better do it with srm . Unfortunately, srm

by default it overwrites each file 7 times, which is 6 times more than necessary. (Use it with the -s option to get one rewrite).



So, if you want to use your find, use:

find . -iname "*swp*" -exec srm -s {} \;

      

Make sense?

+2


a source


depends on where it is running from, but that should be fine, although I would change the match as "* .swp" or "* swp" for a better match



0


a source


if they run as your user id, then the generated files probably cannot be read by anyone else. If they are then, you have more serious security problems.

0


a source







All Articles