How to add or remove a directory in ubuntu

Creating the directory


mkdir directory_name


If the path is protected we need to use sudo command

sudo mkdir dicrectory_name

Removing the directory


rmdir directory_name


If the path is protected we need to use sudo command

sudo rmdire dicrectory_name

Remove the directory including items permanently


rm -r directory_name


More

Make sure you understand the commands actions . Then run the command. Because this can delete all the files and delete files.

Delete All Fills of a directory. Open terminal in that directory and run this command


rm -rf *


Or you can specify the path like this

rm -rf ~/Documents/my_folder/*

it will delete all the files of my_folder

Deleting Specific Folder of a Directory


rm -rf my_folder


One of useful deleting feature. Delete files using the file extension like .mp4 or .txt or like this . Open terminal in that directory.

rm -f *.txt

Or you can specify the directory path


rm -f ~/Documents/my_folder/*.txt