Home » Unix » Add Another Entry to the UNIX Haters’ Handbook

About Shannon -JJ Behrens

Shannon -JJ Behrens
Catholic, father of eight, open source enthusiast, Python, JavaScript, Ruby, Scala, Go, etc. programmer.

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:

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:

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.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy
Notify of

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

Inline Feedbacks
View all comments