A lot of files that we delete, we delete because we think "I have to delete files that are not needed anymore". But this is often a grey area. I have a couple of sets of backups of my previous phones on my machine. That accumulates some 100gb of data.

On linux, it's either rm or not rm. I know that the files still exist on the disk, but the pointer is deleted. Is it possible to do something similar but 1 level higher, meaning that I mark folders as "can be deleted when space is required"? When my disk space hits say 80% usage, each time the usage passes 80%, files get deleted (in some logical order) until the threshold is not passed anymore. This way, I don't delete files, I just say "I probobably won't need this anymore". It serves literally no purpose to prematurely delete files in anticipation of future space requirements.

  • 1
    This looks exactly like what the trash bin of your desktop is doing... But I disagree about "no purpose to prematurely delete files in anticipation of future space requirements". Keeping the disk almost full means that the same blocks are used over and over and accumulate wear. On a less full disk the wear can be distributed more evenly.
    – xenoid
    Commented May 2, 2019 at 9:10
  • I would agree that using the same blocks is bad, hence the idea of the 80% rule which is a common recommendation for SSDs. That said, the trash bin is actually something I completely forgot about as I've been using i3 and mostly terminal based tools over the last years. Commented May 2, 2019 at 9:27
  • See the trash-cli package (on Debian/Ubutnu) to use the trash from the command line, then.
    – xenoid
    Commented May 2, 2019 at 9:36
  • So instead of being aware and proactive about what you deleted you want to end up in a situation where files are missing and you won't be able to tell whenever it was because your latest OS update temporarily needed more storage to unpack/pack files or whenever your machine might be having an actual issue? As others said the best compromise would be trash bin.
    – Seth
    Commented May 2, 2019 at 9:46
  • As an example: Say I have 4TB of disk storage. I have about 500GB of old windows/linux/phone installation iso files, another 2TB of movies / tv shows etc. I'd like to mark these as "delete when needed" because my stream of data going into this disk is only personal photos which have a higher rank of importance. Commented May 2, 2019 at 13:03

1 Answer 1


This seems to be the very behavior of a desktop trashbin. On Linux this The behavior is specified by the FreeDesktop initiative, so all desktop managers work the same way (using the same files/directpries...).

In addition to the desktop GUI, there is a CLI interface to it: install the trash-cli package in Debian/Ubuntu. This provides commands such as trash, restore-trash, etc...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .