Here’s what happened

Here’s what happened

David is a lifelong fan of technology who loves to put his passion into words. David is a lifelong technology enthusiast who enjoys expressing his enthusiasm in words. He was a journalist who discovered Unix’s power when he learned how to edit videos on macOS in the middle 2000s, when Mac OS X was still Mac OS X. He is a retrocomputing enthusiast and appreciates how Linux continues the rich history of Unix. David has a BA degree in communication from California State University East Bay. He has written for Techopedia and TMCnet as well as The Motley Fool’s blog network. His work also appeared in HTG sister publication MUO. rm, the most notorious Linux command is

. One rm error as root can wipe your entire system. Although I was aware of the danger, I still ran this command. Here’s why. Here’s why.

Why do you need to run rm-rf? This was just an experiment. Since I have been using Linux for a long time, I am aware of the dangers associated with running commands such as rm. This was to test what this would do on a current Linux system. Since I only ran this on a virtual Linux machine, I felt a certain level of security. This is not something I would do on my daily driver.

Lastly, I wanted to test how quickly I would be able to recover from a Linux system if something went wrong. VirtualBox allows me to create clones of virtual machines and restore them to previous snapshots. This could be done on a normal system by restoring data from backups.

This is the Linux system that I am destroying.

I have already mentioned I will be using a virtual machine to run this command. It’s a normal Debian install created with VirtualBox. The installation is completely stock after going through the Debian standard process. The machine is dual-core with 4GB RAM. It didn’t seem like a powerful system would be needed for a system that I intended to use to remove everything.

It was lightweight software. The standard Debian desktop software was installed along with my favorite Xfce desktop.

The command I used was

I felt a little trepidation about what I would be doing, even though it was a virtual computer. This innocent looking command was typed in the terminal after I had taken a deep breathe. It said:

rm-rf/

The command will remove every file, starting with the root directory or “/” going recursively down through each subdirectory, “forcing” deletion (meaning proceeding without prompting), whether the file is present or not. This would, in short, delete all files within the Linux installation. This is what I wrote and entered:

. Was expecting Linux to be destroyed. I got the following error:

Rm: It is dangerous to operate on ‘/”
Use –no-preserve root to override the failsafe.

The developers of GNU’s version may have finally fixed rm’s legendary unsafe behavior. I was only able to save myself from total Linux destruction by using a simple command-line. Then I added it, pretending to be a fool who would do this:

Sudo rm –rf/–no-preserveroot

rm now deleted files from the root directory. Do not try this.

What happened to this system? I expected a much more dramatic Linux destruction. In the end, the only thing I saw was an error on the desktop and a black screen with a blinking mouse. The current environment, including the shell and Xfce, was supposed to be retained in memory. This is what I recall happening when I switched a machine from one distro to another in the early days of Linux.

When I pressed Alt and Function keys to try to log in I got nothing. Since I expected the system to be inoperable, and I was already on a virtual machine, I did not panic. I didn’t panic. The machine was off

Was it possible to recover?

My recovery plan was to be tested. It was a casual, unprofessional one. VirtualBox has a snapshot feature. Prior to my attempted total Linux destruction I took a snapshot. To see if it was possible to rollback, I created a snapshot of the virtual machine’s state. It was even better that I only destroyed a copy of my environment. I had nothing to loose if I could not recover. When I shut down the virtual machine, I had an option that I used to go back to my previous snapshot. It restarted the virtual machine into my snapshot, which I had created. I was then back on my Debian Xfce Desktop as if it never happened.

My experiment: Lessons

The Linux experiment shows that Linux is a favourite amongst programmers, and technical people. There are few barriers to what you can do with Linux, even though you could end up doing something disastrous if not careful. For example, you might delete all of your files. Linux is based on Unix and has many ideas that are carried over. “by programmers, for programmers.” You should always be cautious when pressing Enter to execute commands. This is especially true when running destructive commands such as rm.

The episode shows you that you can also recover with the correct strategy. In a real situation, such as an important server I would implement a proper backup strategy. It is possible to recover if you had a plan. You hope to never use it but will be grateful if you do.

View Article Source

Share Article
Facebook
LinkedIn
X
UK businesses restart delayed investment after the Budget, and most of those announcements will go unheard
Berkshire heating engineers put the boiler service first as January bill forecasts climb
As Christmas lists get shorter, Ascot home brand says one lasting piece beats five impulse buys
Secret Link