It is best to avoid these commands if you don’t know what you are doing.


1. rm Command

The rm -rf command is one of the fastest and most effective ways to delete a folder and its contents. However, a small typo or ignorance on the part of the user can result in irreparable damage to the system. Some of the options used with the rm command are:

  • rm command in Linux is used to delete files.
  • rm -r command deletes the folder recursively, even the empty folder.
  • rm -f command removes ‘Read only File’ without asking.
  • rm -rf / : Force deletion of everything in root directory.
  • rm -rf * : Force deletion of everything in current directory/working directory.
  • rm -rf . : Force deletion of current folder and sub folders.

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

A fork bomb is a type of denial-of-service attack that can cause a computer to crash or become unresponsive. It works by creating a large number of processes, which consume all of the computer’s resources and prevent it from being able to service other requests. Fork bombs can be difficult to detect and can be very destructive, so it’s important to be aware of them and take steps to protect your computer from them.


3. command > /dev/sda

command > /dev/sda

The above command writes the output of ‘command‘ on the block /dev/sda. This command writes raw data and all the files on the block will be replaced with raw data. This will result in total loss of data on the block.

4. mv folder /dev/null

mv folder /dev/null

The above command will move ‘folder’ to /dev/null. In Linux /dev/null or null device is a special file that discards all the data written to it and reports that write operation succeed. This is useful if you want to delete a large number of files quickly, without having to worry about the disk space they consume. The /dev/null file is also sometimes used as a “bit bucket” to catch unwanted output from programs.

5. mv /home/user/* /dev/null

mv /home/user/* /dev/null

The above command will move all the contents of a User directory to /dev/null, which literally means everything there was sent to blackhole (null). This is a very powerful command as it can be used to delete all the contents of a directory, including any hidden files. Be very careful when using this command as it cannot be undone.

6. dd if=/dev/random of=/dev/sda

dd if=/dev/random of=/dev/sda

The above command will wipe out the block sda and write random junk data to the block. Of-course! Your system would be left at inconsistent and unrecoverable stage. The only way to fix this would be to reinstall the operating system and all of your programs. This would be a huge pain and it would be very time consuming. It is best to avoid this command if you don’t know what you are doing.

7. mkfs.ext3 /dev/sda

mkfs.ext3 /dev/sda

As you can see from the heading, the above command will format the block ‘sda’ and this will erase all data from your hard disk drive. This is a very dangerous command to execute and should only be done if you are absolutely sure that you want to erase all data from your system. Once this command is executed, there is no turning back and your system will be left in an unrecoverable state.

7 Ways to Create a File through Linux Terminal

%d bloggers like this: