How to Create a Folder in Linux

Create new folders in Linux using either a GUI file manager or the CLI

On any Linux system, create new folders using one of two methods. The first, through a graphical user interface, is context-dependent upon the particular desktop environment you're using. The second—and more common—approach requires access to the shell prompt.

Creating a Folder in a GUI

Regardless of your window manager, the process of creating a folder within the graphical user interface is the same: Open your file manager, right-click anywhere in the open space in the right-side of the pane, and from the context menu click on the create new folder or equivalent option.

Option to create new folder in linux

The major GUIs—GNOME, KDE, Cinnamon, Mate, Budgie, etc.—use the same procedure although the visual motifs differ slightly.

Creating a Folder in the CLI

The more common method involves the mkdir command from a shell prompt. For example, to create a folder called testfolder in your home directory, issue the following command:

mkdir ~/testfolder
linux mkdir command

The command accepts several switches, including:

  • -m: Set the file mode (using the same logic as the chmod command); otherwise, the folder inherits the permissions of its parent.
  • -p: Create parent directories as needed.
  • -v: Prints a confirmation message after each new directory is created.
  • -Z: Set the SELinux security context to the default type.
Was this page helpful?