Live data from Hacker News

How to delete all your files

reddit.com

1–10 of 66 posts

Re: How to delete all your files

#3
I once saw a friend nearly delete all their files using tip#3 from the thread:

> never use only * as a wildcard. A ./* would save you in most cases

My friend typod that for /* in an rm -rf command but caught it just in time. They seemed like unnecessary characters to me if it does the same as *, and I don't think they do it anymore, but now I'm not sure which is worse...

I suppose good backups just go a long way whatever you do.

Re: How to delete all your files

#5
post #3

I once saw a friend nearly delete all their files using tip#3 from the thread: > never use only * as a wildcard. A ./* would save you in most cases My friend typod that for /* in an rm -rf command but caught it just in time. They seemed like unnecessary characters to me if it does the same as *, and I don't think they do it anymore, but now I'm not sure which is worse... I suppose good backups just go a long way what…

[deleted]

Re: How to delete all your files

#6
post #3

I once saw a friend nearly delete all their files using tip#3 from the thread: > never use only * as a wildcard. A ./* would save you in most cases My friend typod that for /* in an rm -rf command but caught it just in time. They seemed like unnecessary characters to me if it does the same as *, and I don't think they do it anymore, but now I'm not sure which is worse... I suppose good backups just go a long way what…

I just did that last weekend!

After an allnighter, which isn't easy for me anymore, I typed:

``rm -rf. /*``

with the dot and the space reversed.

When the shell threw an error in my face, I thought, "oh, an extra dot." so I deleted the dot and re-run the command.

And there goes my configs and most of the dotfiles in my home dir. Luckily, I have backup for some of those, so it wasn't a complete disaster.

I don't trust myself doing ``rm`` in commandline anymore.

Re: How to delete all your files

#8
I think Unix Wildcards Gone Wild (2014)[0] demonstrates and explains this rather well (posted 6 and 4 years ago[1][2] - while HN supports reposting, it's probably been posted enough)

[0]: https://www.defensecode.com/public/DefenseCode_Unix_WildCard... [1]: https://news.ycombinator.com/item?id=8189968 [2]: https://news.ycombinator.com/item?id=17376895

Re: How to delete all your files

#9
An `rm -rf ` always has the potential for some desaster. Especially if you are calling it from bash history via `Ctrl + r` and hit return too fast without editing the argument after `-rf`. Actually the rm command should move files into a `~/.Trash` folder instead of immediately removing them.
Post reply on HN