Social networking enthusiasts often use the acronym TIFU to mean “Today I Fouled Up,” but Linux system administrators know that the F in the acronym stands for something far stronger than fouled. It’s very easy to make the wrong move on a terminal and toast an entire system. This is especially true when working with server architectures that feature a multitude of terminals controlling different individual hosts.
Rather than get worked up about having to work directly from a root shell while administering a large system, take a moment to familiarize yourself with a few hints that will prevent this sort of thing from happening to you.
Preventing a TIFU Moment
Avoid using rm -rf or rm * if you can, though using these is sometimes completely unavoidable. Really give it some thought before you try this. If you absolutely have no choice, then use ls as a check before you do. Say you had to delete everything in a directory starting with a lower case m. Before you ran rm m*, please make sure to run ls m* to see what files will get burned. You should also avoid using chmod recursively if at all possible. It’s too easy to chmod the entire file structure in that way. They sometimes encourage new administrators to issue the command chmod -R 777 /* as a prank, and that is a surefire recipe for a TIFU moment.
The rm -rf /* Linux command is already quite infamous, but you should especially avoid this on a system with a UEFI boot protocol. Since some boot data is mapped to a directory by the Linux kernel, this command could actually wipe it off.
If you’re working with multiple terminals, then you might want to either check the title bar, your prompt or the echo $HOSTNAME command before you use poweroff just to make sure you’re turning off the right machine.
Be exceptionally careful when issuing the chrontab -e command. More than a few people have accidentally issued chrontab -r and deleted tasks in the process. While you’re at it, avoid leaving a terminal shell inside of a desktop environment inside of a directory you’re about to delete in a graphical file manager. The same goes for two virtual consoles with one inside of one while the other deletes a directory. You’ll get errors regarding how your directory doesn’t exist.
One other much less dangerous problem involves sharing OpenOffice or LibreOffice documents with Windows or OS X users. Make sure to save in the RTF, DOC or whatever other formats you’re told to use when sharing files. These users can’t usually open the Linux office software defaults.