Recently I have committed a big mistake: I rm
my home directory. One good aspect of this bad situation is that I have backed up the code directory with borg
. However, my hexo
personal blog is not in the list. To make matters worse, most posts of this blog were stored locally.
The mess is attributed to a simple command: rm
. Although rm
are usually treated as a source of memes at which even newbies would smile knowingly, this worst case happened to me. Here is the command which cause a disaster: rm -rf * '/home/<user_name>/.local/share/Trash/files'
.
Well, I thought I specified a folder to delete everything(*
) in the absolute path(path in the single quote) and expected so. But my home directory was empty after that.
There is an another joke when we talk about rm
: You should install adobe
series in your filesystem because it would hold its own against rm
for a while when you delete your /
root stupidly.
So the conclusion is that you need to rm
files in the current working directory. If not, be aware of *
, like the path you specify in the single quote, is part of argument to tell rm
to delete files. So the command should be rm -rf '/home/<user_name>/.local/share/Trash/files/*'
. I learned this lesson the hard way, and hope you never encounter this kind of issue.
With hindsight, I think I ought to back up files on a regular basis.
Top comments (0)