Unix

Add Another Entry to the UNIX Haters’ Handbook

I was using the command line to quickly build out a file hierarchy. I wrote something that looked basically like:

1
mkdir -p "~/dir/a b/c d"

I meant for dir to be in my home directory. I should have put the ~/ outside the doublequotes. Hence, it actually ended up creating a directory called ~.

I thought, “Well that was dumb. Let me delete that and start over…” So I wrote:

1
rm -rf ~

As you can imagine, that started recursively deleting things from my home directory. I should have put the ~ in double quotes or written ./~.

I hit control-c once I started seeing strange errors, but I was a bit late. It started deleting things all over the place. It complained that it couldn’t delete a bunch of things in ~/Library, but it did end up deleting a bunch of other things there. Apps started acting strangely or crashing. It deleted my Google Drive settings, but not the files themselves. I was really worried that it’d delete the files and synchronize the deletions to the server, but it didn’t. Thankfully, it didn’t delete any of my VMs. That would have been painful.

I eventually just created a new user, switched to that user, moved my stuff out of the way, deleted and recreated my original user, and rebuilt things from scratch using my notes. I tend to log everything I do when setting up a machine. All of my stuff is in the cloud, so I don’t really worry about backups.

BTW, if you haven’t read the UNIX Haters Handbook, it’s a lot of fun. My buddy, Travis, put it perfectly when he said, “I love the UNIX command line, but sometimes it’s a bit like juggling chainsaws.”

Published on System Code Geeks with permission by Shannon Behrens, partner at our SCG program. See the original article here: Add Another Entry to the UNIX Haters’ Handbook

Opinions expressed by System Code Geeks contributors are their own.

Shannon -JJ Behrens

Catholic, father of eight, open source enthusiast, Python, JavaScript, Ruby, Scala, Go, etc. programmer.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button