srm -rlvz to delete a directory, like ‘srm -rlvz DIRNAME’ (r) recursively (dir and all it's contents), (l) overwrites only 2x not default 38x, (z) then with zeros, and shows progress (v verbose).
The standard way is just
srm -f myfile.txt
(f is a single pass)
or
srm -r -v myfolder/
...
USE SFILL (part of secure-delete package) to overwrite unused 'available' space.
Note that sfill is not 'preferred' for SSD drives (it is fine for oldschool disk drives) because it causes wear to SSDs, and another method may be preferred, TRIM method, which Kali already runs once per week, but you can make it more frequent, method described below).
Anyway, here are the sfill commands:
1 pass version: sudo sfill -llv /home/yourusername
(-v is for verbose so you can see it working)
38 passes, slow, scrubbed version: sudo sfill -v /home/yourusername
Sfill will wipe all free space on the partition containing that folder. It will just create a file/files called like 000000 or something, and they will keep getting bigger until they take up the entire available space, and then the file/s will disappear.
If your have an SSD (not an old-school magnetic Hard Drive), you should be careful with these tools.
Wear and Tear: SSDs have a limited number of "writes." Overwriting free space is a massive write operation that can shorten the life of your drive.
TRIM is better: On modern SSDs, the fstrim command is usually more effective and safer. It tells the SSD controller to physically wipe the deleted blocks without the heavy "overwriting" process. sfill is very slow, but trim just takes seconds. Trim is considered 'standard maintenance' and doesn't wear the SSD drive, unlike sfill which does wear out the drive. Data is still 'unrecoverable' on 'most modern SSDs)
On an SSD, data isn't just "forgotten" when you delete a file; it stays in the memory cells until the drive's controller decides to wipe them to make room for new data. fstrim tells the controller, "These specific blocks are empty—go ahead and wipe them now."
Run TRIM with: sudo fstrim -av
-a (All): Tells the program to check all mounted partitions that support TRIM (like your root / and home /home partitions).
-v (Verbose): This provides feedback. It will tell you exactly how many Bytes (or MB/GB) were successfully discarded/cleaned.
Most modern Linux distributions (including Kali) have a "timer" that runs this once a week automatically. You can check if yours is active with: systemctl status fstrim.timer
By default, Kali does this weekly. You can change TRIM schedule to daily with:
sudo mkdir -p /etc/systemd/system/fstrim.timer.d && \
echo -e "[Timer]\nOnCalendar=daily\nAccuracySec=1h" | sudo tee /etc/systemd/system/fstrim.timer.d/override.conf && \
sudo systemctl daemon-reload
What this command does:
mkdir -p ...: Creates the folder where systemd looks for custom settings (overrides).
echo -e ... | sudo tee ...: Writes the "daily" instructions into a new file called override.conf.
systemctl daemon-reload: Forces the system to read the new settings immediately.
How to verify it worked: Run this command to see your new schedule: systemctl list-timers fstrim.timer ... You should see the NEXT column showing a time within the next 24 hours.
Comments: 0