A tragedy caused by rm, it is recommended to use the trash-cli recycle bin to confirm twice before deleting the data.

Original link: https://v2fy.com/p/2023-09-13-13-14-39-trash-put/

1694582302927TdnDdHWZ.png

I saw a forwarded chat record in a group today. In summary, it is the tragedy caused by rm, as follows: For individual webmasters, the risk of logging into the Linux server and running rm manually is still too high. After all, if the hand shakes, or If there is an extra newline in the path, the parent directory may also be deleted. For this, I recommend using alias to block rm (if you use zsh, add the following lines to ~/.zshrc, then source ~/.zshrc; if you use bash, add the following lines to ~/.bashrc OK, then source ~/.bashrc) alias rm=’echo “This is not the command you are looking for.”; false’ The above shielding is only shielded in the shell environment, if you use \rm or /bin/rm it can still be Calling the rm command, for example, using the syntax \rm or /bin/rm, a file can still run normally. Install trash-cli. The trash-cli open source address is https://ift.tt/pU81ILD. The open source address of trash-cli provides many There are three installation methods. Here I take ubuntu as an example. sudo apt install trash-cli. After the installation is completed, we can use trash-cli to delete files. In Linux with a desktop environment (such as Ubuntu desktop version), we use trash- Files or folders put into the Recycle Bin can be seen in the Recycle Bin of the desktop environment trash-put Examples of files or folders to be deleted cd ~/Desktop # […]

This article is reproduced from: https://v2fy.com/p/2023-09-13-13-14-39-trash-put/
This site is only for collection, and the copyright belongs to the original author.