How to Create Multiple Directories in Linux

Linux makes it easy for you to manipulate files and directories with a few steps, or even a single step. If you want to find every .doc file on your hard drive you could do so with a single find command. The methods of actually manipulating elements of directories in Linux are not much more complicated. You simply need to know what command line functions you need and what directory names you you wish to create.

Things You'll Need

  • Linux
Show More

Instructions

    • 1

      Access the shell within Linux. The shell is where you input commands and command line switches in order to manipulate or create files and directories within Linux.

    • 2

      Use the "mkdir" command in the shell. The "mkdir" function is short for "make directory" and is used specifically to create directories within Linux.

    • 3

      Input the "-p" command line switch directly following the "mkdir" command. The "-p" is responsible for telling Linux to create parent directories whenever you are creating multiple directories. You still need to list the names of the directories you wish to create, however.

    • 4

      Complete the command line by entering the actual names of the directories you wish to create. For example, you would type "mkdir -p bin lib" to create a bin and lib directory at the same time.

    • 5

      Create subdirectories at the same time using the same "-p" function. For example, if you wanted to create bin, personal and games directories, but include a chess subdirectory in games, you could simply type "mkdir -p bin personal games/chess." This would instruct Linux to create not only the bin, personal and games directories, but also a games/chess subdirectory.

    • 6

      Ensure you've entered the names of the directories correctly, as well as check that they are in the right place on your drive. You can do this using the "find" command line. Using find simply enter the directories you wish to find in lieu of actual files. This can also be done using the locate command.

Tips & Warnings

  • Not only is it possible to create multiple directories at once using Linux, you can also move or rename directories using the same mixture of command line functions.

  • Proper spelling of your directories is important, especially when you wish to find them later. If you misspell even a single letter in your directory you run the risk of struggling to find it later. Always double-check spelling and syntax prior to pressing "Enter."

Related Searches:

Resources

Comments

You May Also Like

Related Ads

Featured