Categories
Linux Tutorial Series

Linux Tutorial Series – 37 – Be careful with rm

Here is the video version, if you prefer it:

In order to emphasize what can happen if you are not careful while using the rm command, I will tell you a story where I used rm the wrong way.

I was mangling with some drivers. Everything was going fine. I was deleting some files, adding some new files. Nothing fancy. However, at one point, I was a little bit distracted and pressed Enter while I had an instance of the rm command in my Terminal. With that, I just deleted some very important graphics driver files. Ooops!

Obviously, I tried to bring it back, but if you Google something like “how to restore files deleted with rm” you will find that while there are ways, they are all pretty complicated and involve a lot of hassle. That’s what happens when you aren’t careful. I had to reinstall my operating system to fix the issue caused by one accidental rm.

So, once again: Be careful with rm. rm does not forgive.

Thank you for reading!

Categories
Linux Tutorial Series

Linux Tutorial Series – 36 – The rm command

Here is the video version, if you prefer it:

The rm command is used to delete files and directories. (Shotts, 2019) It is used as follows:

rm item1 …

where item1 can be either a file or a directory, and signifies you can specify multiple files or directories.

Two options I found very useful with rm: -i is used to prevent rm from silently deleting files by prompting you before actually deleting them and -r is used for recursive deletion (meaning that both a directory and its subdirectories will be removed).⁠

Be very careful with rm! Let me say that again: Be very careful with rm! rm does not forgive! I highly recommend checking out (“Where do files go when the rm command is issued?,” n.d.)

Hope you don’t accidentally delete some files with rm and hope you found this useful!

References

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 55-57

Where do files go when the rm command is issued? (n.d.). Retrieved January 6, 2020, from https://unix.stackexchange.com/questions/10883/where-do-files-go-when-the-rm-command-is-issued