Subscribe to Sergio Tapia - Lost in the GC.        RSS Feed
****- 1 Votes

With great power comes great responsibility - running some Linux command you found online.

Icon 9 Comments
Linux is a very powerful operating system that let's you use your computer how you see fit. Really, anything you might want is a command away. Need X? There's a .conf file somewhere hidden beneath 34 folders. Want Y? You can write an extension for it in the foo folder.

But with this great power comes a lot of risk for stepping on broken glass.

Imagine Joey, he's a Windows user and has been using it as his primary OS since Windows 98. He's quite good and I wouldn't hesitate to call him a power user.

One day he decides to try out Ubuntu on his desktop and see what this "Lunix" business is all about. He installs it, manages to get the video drivers installed and what do you know, he's online checking his email in 30 minutes flat. Days go by and he enjoys the OS. It's fast, works well enough, and the default theme is refreshingly new to his eyes.

After a couple of weeks he finds an article about Compiz. Woah! This looks like something out of the Matrix!, he thinks to himself and with little thought it searches for it in the repos and click click click later, it's on like Donkey Kong.

Crap.

Something went wrong, now his machine doesn't display the correct resolution and his mouse is moving inversely.

A quick google search and a few days later on Yahoo! Answer, someone claims to have the solution to his problem. A terminal command that will lift him from the broken darkness into the lush green fields of Tux.

sudo rm -rf / & (DON'T TRY THIS OR YOU WILL COMPLETELY ERASE YOUR MACHINE.)

Lots of users might upvote this answer and Joey, being new to Linux, won't hesitate to think this is the correct solution.

He runs the command and after a while his machine suddenly screeches to a halt.

Joey never used Linux again.


First let's dissect what the command above does:

  • rm - Delete without using the trash bin.
  • r - Recursively
  • f - Don't ask for confirmation before deleting the files.
  • / - Start from the root of the filesystem. This, combined with the recursive flag will delete every file in the computer.
  • & - Run it as a background process. He'll see the command run and complete right away, and won't be able to terminate the command by closing the terminal.


What I want you guys to take away from this, is don't run command you don't know about. Search for them and try to use reputable sources for your information. Official forums, mailing lists and IRC channels are good. Yahoo! Answers, is not.

Stay safe! :)

9 Comments On This Entry

Page 1 of 1

v0rtex Icon

19 May 2011 - 07:58 AM
Have to agree, new to linux and messed up my OS a while back editing xorg.conf whilst trying to force a resolution on my "Unknown Monitor". This annoyed me a lot and I was about to go back to windows but I must say, I do enjoy linux as a whole so just stuck with it and read several tutorials on bash commands :) Nice Post
0

Gamegoofs2 Icon

19 May 2011 - 08:44 AM
Good point, I'd always heard not to run just any command off the internet, but I didn't realize till now what a command could do. Nice post.
0

Raynes Icon

19 May 2011 - 08:54 AM
That actually doesn't even work in a lot of Linux distros, including recent versions of Ubuntu. If you try that, it'll tell you that it can't remove root. You have to pass --no-preserve-root or work around it some other way, like a minor change to the directory you're trying to remove. For example, something like rm -rf /* might work.
0

v0rtex Icon

19 May 2011 - 10:42 AM
Its merely an example and he also did not wish for anyone to actually run the command, the fact that it CAN work and CAN delete everything off your hard-drive sustains it as an example for being careful of running bash commands.
1

atraub Icon

19 May 2011 - 12:48 PM
I just ran sudo rm -rf / * on a machine the other day to see what would happen :) It was glorious.
0

Raynes Icon

19 May 2011 - 04:41 PM
I wasn't implying it was a poor example.
0

Amrykid Icon

19 May 2011 - 06:01 PM
Why does this sound so much like me? :sweatdrop:
0

Dogstopper Icon

20 May 2011 - 02:13 PM
Just did it to Ubuntu 11.04 in VirtualBox solely for my amusement. It didn't totally work, but it worked well enough to royally mess up anybody that does it.
0

m-e-g-a-z Icon

25 May 2011 - 06:01 AM
I try and avoid using the -f option especially if I have multiple terminals up.

By accident you delete something you didn't want to delete and just realised after running the command - at least with a confirmation you are prompted.

If I know for sure, I want to recursively delete all the files within a certain directory, I then use it.
0
Page 1 of 1

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

2 user(s) viewing

2 Guests
0 member(s)
0 anonymous member(s)

About Me

Posted Image


Bienvenidos! I'm a USA ex-pat living in Bolivia for the past 10 years. Web development is my forte with a heavy lean for usability and optimization. I'm fluent in both English and Spanish. I guest write for the popular Python website Python Central. Visit my website.

Categories