{"id":1630,"date":"2021-12-16T14:05:51","date_gmt":"2021-12-16T11:05:51","guid":{"rendered":"https:\/\/files2.tojikon.net\/files-cloud\/2021\/03\/31\/how-to-use-bash-to-create-directories-in-linux-guide\/https:\/\/files2.tojikon.net\/files-cloud\/2021\/03\/31\/how-to-use-bash-to-create-directories-in-linux-guide\/"},"modified":"2021-12-16T14:05:51","modified_gmt":"2021-12-16T11:05:51","slug":"how-to-use-bash-to-create-directories-in-linux-guide","status":"publish","type":"post","link":"https:\/\/tojikon.net\/en\/1630-how-to-use-bash-to-create-directories-in-linux-guide\/","title":{"rendered":"How to use bash to create directories in Linux [Guide]"},"content":{"rendered":"<section id=\"related_posts\">\n<div class=\"block-head\">\n<h3>Related Articles<\/h3>\n<\/div>\n<\/section>\n<p>If you need to use the bash terminal to create directories on Linux, the best way to do it is with the\u00a0<strong>mkdir\u00a0<\/strong>command. What is \u201cmkdir?\u201d It stands for \u201cmake directory,\u201d and it\u2019s one of the most valuable tools on all of Linux. With it, you can create folders anywhere on Linux.<\/p>\n<p>There\u2019s no need to install \u201cmkdir\u201d to use it on your computer. In fact, it comes pre-installed on every single Linux operating system out there today. A Linux OS probably couldn\u2019t function without it!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-398732 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-use-bash-to-create-directories-in-linux-guide.png\" alt=\"bash to create directories\" width=\"1200\" height=\"366\"\/><\/p>\n<h2>Use bash to create directories \u2013 Mkdir\u00a0<\/h2>\n<p>To create a directory on your Linux PC with the\u00a0<strong>mkdir\u00a0<\/strong>command, you will need to open up a terminal window. To open up a terminal window on the Linux desktop, press\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>on the keyboard. Or, search for \u201cTerminal\u201d in the app menu.<\/p>\n<p>Once the terminal window is open and ready to use, execute the\u00a0<strong>mkdir\u00a0<\/strong>command below to create a new folder. For example, to make a new folder in the \u201chome\u201d directory (~\/), you\u2019d do the following.<\/p>\n<p>Note: feel free to change (~\/) to wherever you\u2019d like to create the new folder.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-398732 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-use-bash-to-create-directories-in-linux-guide.png\" alt=\"\" width=\"1200\" height=\"366\"\/><\/p>\n<pre>\nmkdir ~\/my_new_folder\n<\/pre>\n<p>It is also possible to use\u00a0<strong>mkdir\u00a0<\/strong>to create multiple directories at the same time in bash. For example, to create 4 folders with the names \u201cfolder_1,\u201d \u201cfolder_2,\u201d \u201cfolder_3,\u201d and \u201cfolder_4,\u201d you\u2019d execute the following command.<\/p>\n<pre>\nmkdir folder_1 folder_2 folder_3 folder_4\n<\/pre>\n<p>To specify the locations of each of the new folders, simply add in the paths. For example, to create folder_1 in <code>~\/<\/code>, folder_2 in <code>~\/Documents<\/code>, folder_3 in <code>~\/Desktop<\/code>, and folder_4 in <code>~\/Videos<\/code>, do the following.<\/p>\n<p>Note: be sure to change each of the folders\u2019 locations to suit your own needs if you want to create multiple folders in different areas with a single command. Additionally, be sure to change the names of the folders in the command, as they are just example names.<\/p>\n<pre>\nmkdir ~\/folder_1 ~\/Documents\/folder_2 ~\/Desktop\/folder_3 ~\/Videos\/folder_4\n<\/pre>\n<p>To delete any of your newly created folders, you can use the\u00a0<strong>rm\u00a0<\/strong>command. For example, to delete \u201cfolder_1\u201d from the home directory (~\/), enter the following command.<\/p>\n<pre>\nrm -rf ~\/folder_1\n<\/pre>\n<p>For more info on how to use the\u00a0<strong>mkdir\u00a0<\/strong>command to create folders using the bash Linux terminal, execute the <strong>man mkdir\u00a0<\/strong>command below.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-398731 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-use-bash-to-create-directories-in-linux-guide-1.png\" alt=\"\" width=\"1200\" height=\"833\"\/><\/p>\n<pre>\nman mkdir\n<\/pre>\n<h2>Use bash to create directories \u2013 NNN<\/h2>\n<p>While the\u00a0<strong>mkdir\u00a0<\/strong>command is excellent, it isn\u2019t the only way Linux users can create new folders using the bash terminal. It is possible to make new folders using the NNN terminal-based file manager. Here\u2019s how.<\/p>\n<p>First, you must install the NNN terminal file manager. To install it, open up a terminal window by using the\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>keyboard combination or by searching for \u201cterminal\u201d in the app menu.<\/p>\n<p>Once the terminal window is open and ready to use, follow the installation instructions below to get NNN working.\u00a0<\/p>\n<h4>Ubuntu<\/h4>\n<p>To get NNN on Ubuntu, use the\u00a0<strong>Apt\u00a0<\/strong>command.<\/p>\n<pre>\nsudo apt install nnn\n<\/pre>\n<h4>Debian<\/h4>\n<p>To get NNN on Debian, use\u00a0<strong>Apt-get.<\/strong><\/p>\n<pre>\nsudo apt-get install nnn\n<\/pre>\n<h4>Arch Linux\u00a0<\/h4>\n<p>On Arch Linux, install NNN with\u00a0<strong>Pacman<\/strong>.<\/p>\n<pre>\nsudo pacman -S nnn\n<\/pre>\n<h4>Fedora<\/h4>\n<p>To get NNN working on Fedora, use\u00a0<strong>Dnf<\/strong>.<\/p>\n<pre>\nsudo dnf install nnn\n<\/pre>\n<h4>OpenSUSE<\/h4>\n<p>On OpenSUSE, NNN is installable via\u00a0<strong>Zypper.<\/strong><\/p>\n<pre>\nsudo zypper install nnn\n<\/pre>\n<p>Once the NNN app is installed on your computer, use the\u00a0<strong>nnn\u00a0<\/strong>command to start up the file browser. Then, use the step-by-step instructions below to use NNN to create new folders.<\/p>\n<p><strong>Step 1:\u00a0<\/strong>In NNN, select the folder you wish to create a folder inside of. For example, to create a folder (with NNN) in the \u201cDocuments\u201d folder, you\u2019d select \u201cDocuments\u201d in NNN using the\u00a0<strong>Arrow\u00a0<\/strong>keys and\u00a0<strong>Enter\u00a0<\/strong>key to select.<\/p>\n<p><strong>Step 2:<\/strong> Once inside the directory in which you are creating a folder, press the <strong>N\u00a0<\/strong>key on the keyboard. By pressing\u00a0<strong>N\u00a0<\/strong>on the keyboard, you will see the following message.<\/p>\n<p><code>'f'ile \/ 'd' ir \/ 's'ym \/ 'h' ard<\/code><\/p>\n<p>This message lets you know your choices when pressing the\u00a0<strong>N\u00a0<\/strong>key on the keyboard. \u201cf\u201d for file, \u201cd\u201d for dir (AKA folder), \u201cs\u201d for symlink, and \u201ch\u201d for a hard link.\u00a0<\/p>\n<p><strong>Step 3:<\/strong> Press the\u00a0<strong>D<\/strong> key on the keyboard to tell the NNN file manager you want to create a new directory using the NNN file manager. After pressing the\u00a0<strong>D\u00a0<\/strong>key, you will see another message in NNN.\u00a0<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-398735 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-use-bash-to-create-directories-in-linux-guide-2.png\" alt=\"\" width=\"1200\" height=\"972\"\/><\/p>\n<p><code>[path\/]name<\/code><\/p>\n<p>Type in the name of the folder into the text box. Then, press the\u00a0<strong>Enter\u00a0<\/strong>key on the keyboard to confirm it. After pressing\u00a0<strong>Enter<\/strong>, you will see your newly created folder in NNN.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Related Articles If you need to use the bash terminal to create directories on Linux, the best way to do it is with the\u00a0mkdir\u00a0command. What is \u201cmkdir?\u201d It stands for \u201cmake directory,\u201d and it\u2019s one of the most valuable tools on all of Linux. With it, you can create folders anywhere on Linux. There\u2019s no &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1631,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[33],"_links":{"self":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1630"}],"collection":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/comments?post=1630"}],"version-history":[{"count":0,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1630\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media\/1631"}],"wp:attachment":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media?parent=1630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/categories?post=1630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/tags?post=1630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}