Hacker News new | past | comments | ask | show | jobs | submit login

Really cool idea. For macOS, I just found out about trash https://formulae.brew.sh/formula/trash



One of the few aliases I always use is:

  alias rm='trash -i'
It will prompt you before moving files to the trash instead of deleting them straight away on macOS.

I've also added the -i flag to the following:

  alias mv='mv -i -v'
  alias cp='cp -i -v'
  alias ln='ln -i -v'
It warns me when a file might be overwritten in the target directory and will display a short protocol of the actions performed due to the 'verbose' flag.


> alias rm='trash -i'

This can really backfire. Ages ago, I used to have exactly the same alias for 'rm'. After a year or two, I got so used to 'rm' not really being destructive that one late night when I was really tired, I used it on a remote system without feeling the need to carefully check the file name. That remote system, of course, did not have 'rm' aliased to a safer version...

Long story short, I strongly recommend using a different alias name (e.g., 'rem', 'rmi' or so). In this case, the worst that can happen is getting a 'command not found' message, when the alias is missing.


I agree, yet I consider this to be the other way round. I treat "rm" still like a direct removal of the file and therefore use it with caution every time. Having it trash the file on my local machines is just a to me hidden fallback. But it is a very valid concern, of course.


I use a similar thing that also handles when you forget -rf, with confirmation & stuff; https://github.com/MikeDacre/careful_rm




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: