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.

Step1 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.

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

Step3 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.

Step4 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.

Step5 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.

Step6 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.

0 comment:

Post a Comment

 

©2009 computer technology World | Template Blue by TNB