Traps in Linux
Linux contains several "traps" which make you break it during use.
First one: the asterisk!
If you enter a remove command like this
rm -R directory/ *
and you add an asterisk afterwards, you delete all directories in the current directory (which does not necessarily mean the directory above the directory you want to delete.
The reason why you may accidentially add the asterisk may be that you are used to enter the asterisk together with -R (necessary with grep), or you cannot decide whether you enter
rm -R directory/
cd directory && rm *.
Or in the second case, you accidentially add a whitespace before the asterisk, especially after auto-completion.
The third case is dangerous anyway, because if directory doesn't exist and you wrote || instead of &&, it will delete the contents of the current directory anyway.
therefore: if you have some important directory, add a file called -i, and it will ask for verification.
Still better, add a file called -ẞ and it will cause an error if it is being tried to remove via asterisk.
Second one: the triangular parentheses
First of all, in documentations, parameters are described as like
if you insert the parameter, you are supposed to omit those triangular parentheses.
Triangular parentheses mean that command input or output should go from (<) or to (>) a file;
if you write a > while you shouldn't, you will overwrite the file with the name right to it.
If you have to insert a < or > in a parameter, you must correctly set it in hyphens.
For example, if you want to grep for <u>, you must write
grep "<u>" test.html
If you omit the hyphens here, you would overwrite the file "test.html"
Third one: the device files
If you use Linux to repair filesystems, you will have to use the device files often. Note that if you specify a device file as copying target for a file, e.g. when you just mounted the device and want to copy it onto its file system, you will overwrite the allocation table, stem directory, and maybe some files on that file system, causing severe damage.
To avoid such a thing, you should preferedly mount the volumes with
-o uid=1000 and access the files without sudo.
if you have something dangerous in your history, and would destroy something if that command would be issued at another time, like
or some copy command, you should, after such commands, use
to delete the history containing the risky command so that you do not accidentially execute it again.