Ubuntu, one of the greatest Linux distributions presently offered, is built on the Debian architecture. This Linux distribution may be installed on servers even though it was created for personal computers (PCs). There are several sorts of folders for storing numerous files on every operating system. Nowadays, most systems struggle with storage capacity, thus we need to delete directories to make room or get rid of duplicate copies of the same directories. In this post, we’ll go through the several techniques Ubuntu offers to remove folders and clear up space.
In file systems, a directory is a structure for classification that includes links to other computer files and sometimes other directories. The main function of a directory service is to handle the same kind of data in one location or to manage interactions between users and their IT resources inside an organization. The procedure for deleting a directory on an Ubuntu 22.04 system will be covered in this article.
Delete a Directory in Ubuntu 22.04
Ubuntu provides both ways to delete the directory: Graphical User Interface and Command Line interface. Below mentioned are some ways to delete a directory.
- Delete Directory via GUI
- Delete Directory via Terminal
Below these ways are explained in detail.
Delete Directory using GUI
You may also remove the directory using the GUI technique if you are a newbie and are not familiar with using the Linux terminal.
Right click the directory and choose “move to trash” from the menu that appears. I will place the mouse over the “Linux” directory in the Documents folder, left click on it, and then choose the option “move to trash” from the drop-down list, as shown below, to remove it.
As seen below, after choosing this option, you should be able to notice that the directory is no longer accessible.
Delete Directory via Terminal
With the “rm” command, you can remove anything from Linux file systems such as files, symbolic links, directories, and more. Since you won’t be able to retrieve the data from deleted files or directories, you should exercise care while utilizing this process, which often operates silently. Unless a specific option is supplied, it does not by default destroy any directories.
How to Delete Empty Directory
Rm can be used to remove an empty directory using the syntax listed below.
$ rm -d directory_name