Linux basics - managing directories(creating & deleting)🧵↓
You will regularly need to create and delete directories on the Linux system as a system administrator. The mkdir, rm, and rmdir commands make this possible.
The preceding example will create the srcs directory within the projects directory; however, the parent directory (projects) must already exist for this to work; otherwise, an error will occur.
Deleting directories🐧
Of course, once you've created anything, you'll need to know how to remove it. This is very beneficial if you have a directory taking too much of your system space or you accidentally created a directory in the wrong location.
Of course, once you've created anything, you'll need to know how to remove it. This is very beneficial if you have a directory taking too much of your system space or you accidentally created a directory in the wrong location.
Removing directories in Linux can be tricky. When you begin deleting directories, there are numerous opportunities for bad things to occur. The Linux shell makes every effort to keep us safe from unintentional disasters.
As previously stated, the rmdir command deletes empty directories. What if you want to delete directories that contain files? This is where the remove command comes in.
Note 💡
The -r and -R parameters for the rm command have the same effect — it recursively traverses the directory removing files.
The -r and -R parameters for the rm command have the same effect — it recursively traverses the directory removing files.
As previously stated, deleting directories can be tricky if you don't know what you're doing. The above command is extremely dangerous; therefore, use it sparingly and only after triple-checking that you're doing exactly what you want!
This allows you to double-check each file that needs to be deleted before deleting it.
That's it for today's thread.
Thank you taking your time to read it.
If you enjoyed this thread, follow us @linuxopsys for future Linux posts, which we will be posting on a daily basis.
Thank you taking your time to read it.
If you enjoyed this thread, follow us @linuxopsys for future Linux posts, which we will be posting on a daily basis.
Loading suggestions...