How To Delete Files In Linux 100%

Mutt

Professional
Messages
1,057
Reputation
7
Reaction score
595
Points
113
Every day we are deleting files for different reasons, so we are moving them to trash, but it's only away from our folder, not from our computer/laptop.
So what we can do in Linux to remove it permanently?

Maybe you heard about "Zero Filling", it's a method to overwrite something with zeros. It is often used by formatting (f. e. DBAN), and also the process can not be undone.

A tool called shred can help us in this case.
Our file is photo.jpg.

Code:
$ shred <options> <file>

-v = verbose output
-f = change permissions to allow writing
-z = add a final overwrite with zeros to hide shredding
-u = deallocate and remove file after overwriting

Code:
$ shred -vfzu test1.png
shred: test1.png: Durchgang 1/4 (random)...
shred: test1.png: Durchgang 2/4 (random)...
shred: test1.png: Durchgang 3/4 (random)...
shred: test1.png: Durchgang 4/4 (000000)...
shred: test1.png: wird entfernt
shred: test1.png: in 000000000 umbenannt
shred: 000000000: in 00000000 umbenannt
shred: 00000000: in 0000000 umbenannt
shred: 0000000: in 000000 umbenannt
shred: 000000: in 00000 umbenannt
shred: 00000: in 0000 umbenannt
shred: 0000: in 000 umbenannt
shred: 000: in 00 umbenannt
shred: 00: in 0 umbenannt
shred: test1.png: entfernt

And you can try to recover it, but it's impossible.
 

Father

Professional
Messages
2,601
Reputation
4
Reaction score
631
Points
113
Auto-delete files from the trash
Also, if there is a shortage of available memory, the trash must be constantly cleaned. Many people will say that this process is not complicated, but users with a small amount of memory will tell you the opposite, because this process is simply boring.

Follow the path:
Start Menu - "Options" - "System" - "Memory".
In this section, enable "Memory Monitoring Function". Go to " Configure memory monitoring or run it"
Just below there will be a menu that says "Delete files from the trash if they are no longer there". In this section, set up the amount of time allowed for the trash to be emptied.
 
Top