Skip to content

How to create and remove Directories in Linux

October 15, 2022
creating and Removing directories in linux

This blog post provides a step-by-step guide on how to create and remove Directories in Linux using the mkdir and rmdir commands.

Creating and Removing Directories

  • mkdir creates directories
  • rmdir removes empty directories
  • rm -r recursively removes directory tress

Directory Management

Directories are created with mkdir. For example, to create a directory called work:

amar@amar-pc:~/Desktop$ mkdir work
How to Create and remove Directories in Linux

To remove an empty directory, use rmdir. For example:

amar@amar-pc:~/Desktop$ rmdir work
How to Create and remove Directories in Linux

rmdir will only remove empty directories. To remove a directory and its contents, use rm -r.