Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the 10 very dangerous Linux commands?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "what are 10 very dangerous Linux commands". The editor shows you the operation process through actual cases, the operation method is simple and fast, and it is practical. I hope this article "what are 10 very dangerous Linux commands" can help you solve the problem.

Computer operating system is a platform for managing computer software and hardware resources. Without it, no computer can run normally. The mainstream operating systems on the market are Windows, Unix, Linux and Mac OS X.

Here we mainly talk about the Linux system. Linux is an open source operating system similar to Unix, which mainly has the following features:

Open operating system

Linux is a free software, developers are free to install and modify the source code of the software, compared with the command line operation of Unix, Linux provides a window management system, relatively easy to operate, enterprises can use Linux free of charge, greatly reducing the cost budget.

Strong hardware support

The Linux system is very easy to maintain, and users can update the operating system and all installed software centrally, which is both safe and efficient. Linux can effectively use system resources, allow users to install according to specific hardware requirements, and allow Linux to be installed on old computers, thus helping to make the best use of computer hardware resources.

High security and stability

Under the Linux system, unless the user logs in as root, the program cannot change the system settings and configuration, and it is rare that the computer cannot be started because of the user's misoperation. Linux is very stable and not easy to crash, and Linux will be able to run at the same speed in a few years as it was when it was first installed. And Windows may not be able to keep up with the speed after half a year of operation.

Sooner or later, Linux systems will be as popular as Windows, and more and more people will use them. But no matter how perfect the system is, Linux not only gives you the maximum degree of freedom, but also makes it easier to destroy the system. If you don't understand the meaning of certain commands, download and execute scripts that contain malicious commands, or be tricked into running certain commands, it's easy to make you cry.

This does not mean that Linux is not safe, it just means that we do not understand Linux, Windows or Linux, people themselves are the biggest unsafe factor.

Here's a summary of the ten most dangerous orders:

(warm reminder: please remember not to try them on servers or other devices at random. If you want to test them, run them on a virtual machine, otherwise it will be bad for files to be lost or the system to crash. )

1. Rm-rf command

The rm-rf command is one of the quickest ways to delete folders and their contents, but minor errors or poor syntax awareness can cause irreparable damage to the system.

The following are options for some rm commands:

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

The rm-r command recursively deletes folders, even empty folders.

The rm-f command deletes' read-only files' without being asked. Deleting a file under Linux does not care whether the file is read-only, but whether its parent directory has write permission. So, the parameter-f just means that you don't have to delete the confirmation one by one, but delete it all quietly. In addition, the original rm command does not actually delete the prompt, but the general distribution will add the rm alias to the-I parameter to request deletion confirmation, and-f suppresses the prompt.

Rm-rf /: forces the deletion of everything in the root directory.

Rm-rf *: forces the deletion of all files in the current directory.

Rm-rf. Forces the current folder and its subfolders to be deleted

From now on, please be careful when you execute the rm-rf command. We can create an alias for rm-I in the ".bashrc" file to the 'rm' command to prevent accidents when deleting files with the' rm' command, which asks you to confirm each delete request. Most distributions have already done this, if not, do so, and be sure to think about what you are doing before using the-f parameter! The translator himself has learned the lesson of blood and tears. )

2.: () {: |: &};: command

This command is actually a fork bomb that defines a function called ":" and calls itself twice, once in the foreground and once in the background. The point is that such a call loops indefinitely until the system crashes.

Skeptical students can try it in the virtual machine:

3. Command > / dev/sda

This command writes the output of a 'command' to the block device / dev/sda.

In this way, the files in / dev/sda will be replaced by the output of the command, and the original data will be lost.

4. Mv folder / dev/null

This command moves a 'folder' to / dev/null.

Under linux, / dev/null or null is a special file that discards all data written to itself and returns a message that the operation was successful.

Of course, it is important to note that this command does not stop the data recovery software-so the real complete destruction needs to be done with dedicated software or techniques.

The above command will move everything under / home/user/ to / dev/null, which is a bottomless pit.

5. Wget http://-O-| sh

This command downloads a script from a (perhaps) malicious source and executes it.

The Wget command downloads the script, and sh executes the downloaded script (unconditionally).

Note: you should always pay attention to the source of your download package or script. You can only use those that download scripts / programs from trusted sources.

6. Mkfs.ext3 / dev/sda

The above command will format the block device 'sda',. After executing the above command, your hard drive will be marked as new. Of course, the system can no longer recover data at this time.

Usually we don't use devices like / dev/sda directly unless they are used as raw devices.

Generally speaking, you need to divide sda into partitions such as sda1 and sda2 before using it. Of course, whether you use sda or sda1, this mkfs of block devices or partitions is devastating, and the above data will be evaporated.

7. > file

This command is often used to empty the contents of a file or to record command output.

However, please make sure that the output file is empty or does not exist before execution, otherwise the original file will not be recovered-even the data recovery software may not be able to help you.

What you may really want to use is ">", which accumulates new output to the file instead of refreshing that file.

Incorrectly or ignorantly typing commands like "> xt.conf" with the above will overwrite the configuration file or any other system configuration file.

8. ^ Foo bar

This command is used to edit previously run commands without retyping the entire command.

In this way, by using the ^ symbol, you can directly edit the previously run commands by flipping up and completing the commands. Although you may not have to type the whole long command as a result, it can be dangerous.

If you do not thoroughly examine the risk of changing the original command when using the foobar command, this can lead to real trouble.

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

The dd command will erase the contents under / dev/sda, then write random junk data, and eventually your system will be irreversibly damaged.

Remember when it was said that mv to a black hole can't delete data completely? Then this command gives you a way to delete it completely! Of course, just to be on the safe side, you can rewrite it many times.

10. Hide command

The following command is the equivalent of rm-rf, which is hidden in hexadecimal hex, and an ignorant user may be fooled, and running the following command from the terminal may erase your root partition.

The real danger is hidden and cannot be easily detected. You must always pay attention to what you are doing and what will happen.

Remember, never compile / run code from unknown sources.

This story tells us that when deadly threats are hidden, it can be difficult for us to find them.

That's all for "what are the 10 very dangerous Linux commands?" Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report