Skip to content

Dangerous Linux commands you should NEVER use!!!

1 .The command sudo rm -rf /* is one of the most dangerous Linux commands you can run on a Linux system. Here’s what it does:

Breakdown of the Command:

  • sudo: This allows the command to be run with superuser (root) privileges, giving it the authority to delete almost anything on the system, including system files and directories.
  • rm -rf:
    • rm: This command removes files and directories.
    • -r: This option tells rm to remove directories and their contents recursively (i.e., everything inside the directory and all subdirectories).
    • -f: This option forces the removal of files and directories without prompting for confirmation, even if they are write-protected.
  • /*: The /* pattern matches everything in the root directory (/), including all files and directories at the top level of the filesystem.

What Happens When You Run This Command?

  • Effect: This command attempts to delete every file and directory on the entire filesystem starting from the root directory (/). Since it runs with sudo, it has the necessary permissions to delete system-critical files and directories.
  • Result: If this command is executed, it will effectively wipe out the entire operating system and all data on the machine, rendering the system completely unusable. Recovery from this is extremely difficult, if not impossible, without backups.

2. The other dangerous Linux command you should never use is the alias cd='rm -rf' which is extremely dangerous and should not be executed under any circumstances.

Here’s what it does:

  • alias cd='rm -rf': This command creates an alias in the shell, replacing the cd command with the rm -rf command.
  • cd: Normally, this command is used to change the current working directory.
  • rm -rf: This command forcefully removes (deletes) files and directories recursively, without asking for confirmation.

What Happens When You Use This Alias?

After setting this alias, every time you try to use cd to change directories, it will instead run rm -rf followed by the directory name you provided. This will result in the immediate and irreversible deletion of the directory you intended to navigate to, including all of its contents.

Example: If you type cd /home/user/Documents, the shell will instead execute rm -rf /home/user/Documents, deleting the entire Documents directory and all its contents.

Summary

  • Never run sudo rm -rf /* unless you intend to completely destroy the system.
  • This command is often cited as a classic example of a “doomsday” command in Unix-like systems.
  • Do not run the alias cd='rm -rf' command unless you intend to delete directories every time you try to change them.
  • If you see this alias in any script or configuration file, remove it immediately to prevent accidental data loss.
Guide to Linux Laptop Battery Optimization in 2026

Beyond TLP: The Ultimate Guide to Linux Laptop Battery Optimization in 2026

For years, the standard advice for any Linux laptop user has been: “Just install TLP and forge…

How to Install VS Code on Ubuntu (24.04, 22.04 and 20.04)

How to Install VS Code on Ubuntu (24.04, 22.04 and 20.04)

Updated: May 2026 | Three methods covered | Works on all active Ubuntu LTS releases VS Code is the m…

best Linux Distro for Old Laptops

Best Linux Distro for Old Laptops in 2026 (Your Windows 10 Replacement Guide)

Updated: May 2026 | Tested on hardware with 1GB–8GB RAM | Covers laptops from 2010–2020 Windows 10 s…