Use with caution on Linux systems. Dangerous commands for Linux

  

The Linux command line is useful, efficient, and fun, but sometimes dangerous, especially if you are not sure what you are doing. The following commands are usually 诒oot permission to play stupid to the extreme; under the ordinary user identity, the destruction is only one's own acre three-point cellar!

1, rm-rf command

The rm-rf command is one of the fastest ways to delete a folder and its contents. Just a little bit of mistake or ignorance can lead to an unrecoverable system collapse. The following are some of the options for the rm command.

The rm command is usually used to delete files under Linux.

The rm-r command recursively deletes folders, even empty folders. (Annotation: Personally think that this should be wrong, from common sense, it should be "even a non-empty folder")

rm-f command can be deleted without asking ‘ read-only File & rsquo;. (Annotation: Linux delete files does not care whether the file is read-only, but just care whether its parent directory has write permission. Therefore, the -f parameter simply means that you do not have to delete the confirmation one by one, but will be silently deleted. The original rm command does not actually delete the prompt, but the general distribution will add rm by alias to the -i parameter to request deletion confirmation, and -f suppress this prompt.)

rm- Rf/: Forces deletion of all the roots in the root directory. (That is, after deleting, there is nothing ……)

rm-rf*: Forces deletion of all files in the current directory.

rm-rf.: Forces deletion of the current folder and its subfolders.

From now on, be careful when you want to execute the rm-rf command. We can create an rm-i alias in the “.bashrc” file pair ‘rm‘ command to prevent accidents when deleting files with the ‘rm‘ command, which will ask you to confirm each delete request. (Annotation: Most distributions have already done this, if not, please do so, and must consider what you are doing before using the -f parameter! The translator himself has a lesson of blood and tears.)



2,:(){: :&};:Command

This is an example of a fork bomb. The specific operation is to define a function named ‘:‘, it will call itself twice, once in the foreground and another in the background. It will be executed repeatedly until the system crashes.


Oh? Are you sure you want to try it? Don't experiment on the company's official server~~

3. Commands>/dev/sda

The above command will write the output of a ‘ command & lsquo; Block device /dev/sda. This operation replaces all data blocks in the block device with the original data written by the command, resulting in data loss for the entire block device.

4, mv folder /dev /null

This command will move some & lsquo; folder & lsquo; to /dev /null. In Linux, the /dev/null or null device is a special file, all data written to it will be cleared, and then the write operation will be successful. (Annotation: This is a black hole. Of course, it should be noted that by moving the folder to the black hole, it does not prevent the redemption of the data recovery software, so the real complete destruction requires special software or techniques to complete — — I know you definitely have something to delete.)


The above command will move all the contents of the User directory to /dev/null, which means everything Both are involved in & rsquo; black hole (null).

5, wgethttp://malicious_source-O- sh

The above command will download a script from a (perhaps) malicious source and execute it. The Wget command will download the script, and sh will (unconditionally) execute the downloaded script.

Note: You should always pay attention to the source of your download package or script. Use only those scripts/programs that are downloaded from a trusted source. (Annotation: So, do you really know what you are doing? When it comes to this need, my approach is to wget it down, then I will read what I wrote and then consider whether to implement it. )

6, mkfs.ext3 /dev /sda

the above command formatting block device & lsquo; sda & rsquo ;, you certainly know your command in the execution of the above block The device (hard drive) will be formatted, brand new! Without any data, let your system reach an unrecoverable phase. (Annotation: usually do not directly use devices such as /dev/sda, unless it is used as a raw device, generally need to be divided into sda1, sda2 and other partitions. Of course, whether you use sda ​​or sda1, so Mkfs is devastating for block devices or partitions, and the above data will be evaporated.)

7,><<>

The above commands are often used to empty the contents of the file. Usually used to record command output, but please confirm that the output file is empty or does not exist before execution, otherwise the original file can not be recovered. —— even data recovery software may not be able to help you. Also, I think what you might really want to use is “>>”, that is, accumulate new output to the file instead of refreshing that file.). If you enter an error or ignorant input with the above execution, the command similar to “>xt.conf” will overwrite the configuration file or any other system configuration file.

8,^foo^bar

This command was described in our little-known Linux command - Part 3, which is used to edit previously run commands without having to replay the entire command. But when you use the foobar command, if you don't thoroughly check the risk of changing the original command, this can cause real trouble. (Annotation: In fact, this kind of trick is what the translator thinks, a few useless and harmful "hidden" hackers left behind in prehistoric times.)

9, ddif=/dev/randomof=/Dev/sda

The above command will write a random junk file to the block device sda ​​to erase the data. of course! Your system may be in a state of confusion and unrecoverable. (Annotation: Remember to say that mv to black hole can not completely delete the data? Then this command is to give you a completely deleted method! Of course, for the sake of insurance, you can overwrite multiple times.)

10 , hidden commands

The following command is actually the first command above (rm-rf). The code here is hidden in hexadecimal, and an ignorant user may be fooled. Running the following command in the terminal may erase your root partition.

This command indicates that the real danger is usually hidden and will not be easily detected. You must always be mindful of what you are doing and what will happen. Do not compile/run code from unknown sources.

Copyright © Windows knowledge All Rights Reserved