Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Skip to content

Dangerous Linux commands you should NEVER use!!!

  • by

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.
Linux Package Management Cheatsheet

Linux Package Management Cheatsheet

Package management is a crucial part of administering a Linux system. Different distributions use di…

check linux kernel

How to Check the Kernel Version of a Linux System

The Linux kernel is the core of any Linux-based operating system, managing hardware and system resou…

reactos

ReactOS: A Free and Open-Source Windows-Compatible Operating System

ReactOS is a unique operating system that aims to provide a free and open-source alternative to Micr…