Discover, install, and configure shell plugins with Fig Plugin Store →

Zsh Safe rm

ZSH Plugin to add safe-rm functionality so that `rm` will put files in the trash.

17 stars
2 forks


ZSH plugin to add safe-rm functionality so that rm will put files in your OS's trash instead of permanently deleting them.


rm is aliased to use safe-rm, which is a drop-in replacement for rm with all the same flags for a seamless transition.

del is also aliased to safe-rm to help re-habit your muscle memory to a less destructive command. That way, if you are ever on a system without safe-rm, you aren't too confortable with using rm as a safe command. del is the recommended way to use safe-rm.

As with all zsh commands, if you need to get back to the builtin rm, there are options:

# simply use a leading backslash
\rm -i obliterate_me.txt

# or use 'command' prefix (command is a "zsh precommand modifier")
command rm -i nuke_it_from_orbit.txt

# or make an alias in .zshrc
alias unsafe-rm="command rm -i"
unsafe-rm this_is_really_gonna_hurt.txt


Installable with:

  git clone --recursive --depth 1 $ZSH_CUSTOM/zsh-safe-rm
  # now add zsh-safe-rm to your plugins variable in .zshrc
  • antibody: antibody bundle mattmc3/zsh-safe-rm
  • antigen: antigen bundle mattmc3/zsh-safe-rm


This project is a zsh plugin wrapper for the shell-safe-rm project and assumes no liability for the functionality of that utility. Bugs or issues with the safe-rm functionality should be submitted to that project's maintainer.