![](/static/be9a2c79/assets/icons/icon-96x96.png)
![](https://lemmy.ml/pictrs/image/q98XK4sKtw.png)
If you’re scared to do rm -rf
, do something else that lets you inspect the entire batch of deletions first. Such as:
find .git ! -type d -print0 | xargs -0 -n1 echo rm -fv
This will print out all the rm -fv
commands that would be run. It’s basically rm -rf --dry-run
, but rm
doesn’t have that common option. Once you’ve verified that that’s what you want to do, run it again without echo
to do the actual deletion. If you’re scared of having that in your history, either use a full path for .git, or prepend a space to the non-echo version of the command to make it avoid showing up in your shell history (assuming you have ignorespace in your HISTCONTROL env var)
I use this xargs echo
pattern a lot when I’m crafting commands that are potentially destructive or change lots of things.
Or a tui file manager like
ncdu