How to create a directory in Linux?

In Linux systems, directories can be created using either the command line or graphical interface.

  1. Create a directory using the command line.
  2. Open the terminal.
  3. To create a directory using the mkdir command, simply add the directory name after the command. For example, to create a directory named mydirectory, you would type: mkdir mydirectory.
  4. To create a subdirectory within an existing directory, you can use the mkdir command with the path and directory name. For example, to create a subdirectory named “mydirectory” within the /home/user/ directory, you can enter the following command: mkdir /home/user/mydirectory.
  5. The -p option can be used to create multiple levels of directories. For example, to create a directory at the path /home/user/documents/mydirectory, you can enter the following command: mkdir -p /home/user/documents/mydirectory.
  6. Create a directory using a graphic interface.
  7. Open a file manager such as Nautilus for GNOME desktop environment or Dolphin for KDE desktop environment.
  8. Navigate to the location where you want to create a directory.
  9. Right-click on a blank space and select “New Folder” or a similar option.
  10. Enter the directory name and press enter to create the directory.

Sufficient permissions are required to create a directory in the selected location, regardless of using the command line or GUI.

bannerAds