I'd like to know how can i set a mounted partition to send deleted files from main directory to the "recycle bin" on CentOS 7. They all are removed directly.
1 Answers
This depends completely on the method of deletion. If you are issuing rm -rf
on this secondary mounted partition you will never get those files back without using a file system that allows you to restore from a previous snapshot or you have backups.
You can however use trash-cli
or create an alias like described in the related answers here and here to delete things from the command line and place them in a "recycle bin". If you use a graphical file manager like Nautilus or Dolphin, things deleted from mounted partitions typically go to a "recycle bin" by default.
Install trash-cli
using yum install trash-cli
Delete a file by issuing trash-put /path/to/file
Use trash-list
to see what is in the trash currently and use trash-restore
to restore the deleted file. And to empty the trash you simply issue trash-empty
. Using trash-empty 30
clears out all files that have been in trash for 30 days or longer.
Alternatively you can add an alias to your .bashrc
that you will use instead of rm
that user Kusalananda does in this answer.
alias trash='mkdir -p "$HOME/.trash" && mv -b -t "$HOME/.trash"'

- 5,280
- 7
- 21
- 36