Linuxopsys Profile picture
Feb 23, 2023 โ€ข 23 tweets โ€ข 6 min read โ€ข Read on X
12 destructive Linux terminal commands every Linux user must be aware of (don't run these):
1. Recursive deletion ๐Ÿ”๐Ÿ—‘๏ธ

This is one of the scariest commands. When you run this command, it deletes everything in the root directory forcibly and recursively. As a result, all of your directories and subdirectories will be deleted, and all of your data will be lost.
2. Implode hard drive ๐Ÿ•ณ๏ธ

This command will move all data to a special location in Linux known as the black hole, which is located in your system at /dev/null.
Everything that is moved to this location is destroyed.
As a result, if you accidentally move your data to this folder, it will not be recovered
3. The fork bomb ๐Ÿด๐Ÿ’ฃ

This is my personal best, a simple bash recursive function that, when executed, creates copies of itself, which in turn creates another set of copies of itself. This takes up CPU time and memory. As a result, it loops until the system freezes.
Fortunately, you can defend against this attack by limiting the number of processes run by users to around 4000.

You can accomplish this by issuing the following command:

$ ulimit -S -u 4000
4. Overwrite the hard drive โœ๏ธ๐Ÿ’ฟ

This command writes raw data (command output) to the specified partition. This causes data loss on the hard drive or specified partition.

command - this could be any Linux command.
5. Blindly download and execute malicious script โ˜ ๏ธ๐Ÿ“œ

Wget and curl are useful Linux commands for retrieving and downloading files from the internet. However, if we blindly download and execute a malicious script, these commands can be dangerous.
Please keep in mind the source from which you are downloading packages and scripts. Use only scripts or applications downloaded from a reputable source.
6. Breach the System ๐Ÿ”“

This command does not physically affect your system in the same way that the other commands do, but it does provide a security breach on the system.
The chmod command changes file permissions to configure user access to a specific file or directory.

By running this command, you grant all system users the ability to read, write, and execute data on your system. In terms of security, this is risky and dangerous.
7. The hidden recursive deletion (rm -rf /) ๐Ÿ”๐Ÿ—‘๏ธ

The following command is the same as the previously mentioned rm -rf / command. The codes are hidden in hex here to fool an unsuspecting user.
Running the code below in your terminal will delete your root partition leaving your system unusable.
8. Unknowingly format a hard drive ๐Ÿงน๐Ÿ“€

This command will erase your hard drive and recreate it.
These should only be used when you have a backup of your data on the cloud or an external device.
9. Write random junk to hard drive ๐Ÿˆณ๐Ÿ“€

This command will write random garbage data to your hard drive.
Your system will not be recovered as a result of this command.
10. Re-running all the history commands ๐Ÿ”๐Ÿ“œ

Because it executes every command from that you have already executed, the history | sh command can be dangerous. The action may cause system instability and the execution of commands that you do not want to repeat.
11. The ^foo^bar Command ๐Ÿ“œ

The ^foo^bar command has the potential to be both helpful and dangerous. While the command saves time by allowing you to edit a previously run command and re-run it,
it can also cause problems if you don't thoroughly check the changes you make before running it.

The command changes the first occurrence of foo to bar.
12. Blindly deleting the crontabs ๐Ÿค–๐Ÿ“œ

The crontab command aids in the automation of routine tasks. All commands and instructions, however, are saved in a single crontab file, which can be removed by using the -r option and the crontab command.
This can happen if you want to specify the -e flag but accidentally type -r. There is no yes/no prompt before removing the file, so be cautious.

Make a backup of your crontab file because there aren't many recovery options if it gets deleted.
Please DO NOT run any of the above commands in your Linux terminal or shell, or on the computers of your friends or coworkers. Run them in a virtual machine if you want to test them.
Any inconsistency or data loss caused by the execution of the preceding command will bring your system to a halt.
That's a wrap!

Thank you for taking your time to read our thread.

If you know of any other dangerous Linux commands that I have missed, please leave them in the comments.

And be sure to rt, like and follow us (@linuxopsys) for more future Linux content.

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Linuxopsys

Linuxopsys Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @linuxopsys

Feb 17, 2024
If you have used Linux systems, you are likely familiar with the standard read, write and execute permissions that can be assigned to files and directories.

However, the standard Linux perms only allow you to assign access rights to the owner, the owning group, and evryone else Image
What if you want to give your colleague John permission to read a specific file without giving everyone else the same access? This is where access control lists (ACLs) come in handy.
What are ACLs?

ACLs provide more granular control over file and directory permissions by allowing you to set access rights for specific users and groups rather than just owner, group and world.
Read 15 tweets
Feb 12, 2024
Linux networking commands that every sysadmin should know: Image
1. arp - manipulate the system ARP cache

2. aria2 โ€“ downloading just about everything. Torrents included.

3. arpwatch โ€“ Ethernet Activity Monitor.

5. bmon โ€“ bandwidth monitor and rate estimator.

6. bwm-ng โ€“ live network bandwidth monitor.
7. curl โ€“ transferring data from or to a server.

8. darkstat โ€“ captures network traffic, usage statistics.

9. dhclient โ€“ Dynamic Host Configuration Protocol Client.

10. dig โ€“ a flexible tool for interrogating DNS name servers.
Read 27 tweets
Jan 23, 2024
Linux command line tools for parsing and analyzing logs ๐Ÿงโ†“
Linux logs are a valuable resource for system administrators, network administrators, developers, and security professionals.
They record a timeline of events on a Linux system, such as operating system events, application activity, and user activities and actions (for example log-in attempts).
Read 25 tweets
Jan 13, 2024
paste command in Linux explained

(simple yet powerful way to merge and organize data from multiple text files):

Learn more about the paste command in this master guide: Image
The paste command merges lines of files horizontally by combining corresponding lines from each file specified as an argument and separating them with tabs.

In this thread, we will guide you on how to utilize the paste command effectively.
How to use the paste Command

The paste command is not as commonly used as other Linux and Unix command-line utilities, but it can be incredibly useful.

The paste command has the following syntax:

$ paste [OPTION]... [FILE]...
Read 22 tweets
Jan 6, 2024
10 sed command practical examples that will make you a Linux power user: Image
A brief introduction on the sed command:

Sed (short for stream editor) is a powerful command-line tool used for text manipulation in Unix-like operating systems.
It provides a wide range of features to search, delete, find, substitute (find and replace), inserting, and appending text using regular expressions. In this thread, we will explore 15 sed command practical examples that will make you a Linux power user.
Read 26 tweets
Jan 5, 2024
What exactly are bash exit codes in Linux?๐Ÿค”

Learn more in this complete guide ๐Ÿงต โ†“ Image
When writing Bash scripts, you will frequently need to stop the execution of a script when a certain condition is met or perform some actions based on a command's exit code.
In this thread I will go over the built-in bash exit command as well as the exit statuses of the commands that have been executed.
Read 14 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(