Here, you’ll learn how to create a directory in Linux. These steps also work in many Linux distributions, such as Ubuntu, Raspbian, Debian, and so on. Even with headless, terminal-only Linux systems, these methods allow you to quickly and easily create new directories and subdirectories in your Linux environment.
What is a Directory?
In this context, a directory serves as the location for storing some of your files in a computer. It’s located inside a hierarchical file system for operating systems like MS-DOS, UNIX, OS/2, and of course, Linux itself. Directories are also used to organize, store, and separate files and other directories inside a computer.
How to Create a Directory in Linux
If you want to create a directory in UNIX, Linux, or other variants, then you can use Linux’s mkdir UNIX directory command. Also, keep in mind, you can configure a set of parameters or access privileges for each directory. This includes modification, access, removal permissions, and many more. Here are quick and simple steps to do this:
- Take a look at the directory you’re currently in before you use the mkdir command. This will get rid of any errors you commit later on, especially if you use a directory where you don’t have too many command privileges. You can check this when you use the pwd command in the terminal window, and then press Enter;
- For a step-by-step process, open up the terminal, type mkdir [directory], and press Enter — Keep in mind that you don’t need to write the s, and “directory” is the name that you want for your new directory. For instance, to build a directory that you want to call “business”, you can type “mkdir business” without the quotes. Also, remember that this creates the directory inside the current working directory, which you’ll see from the prompt in the terminal;
- You can then use the “-p” command in the terminal. This builds subdirectories inside a parent directory. This means creating a structure inside various subdirectories using the mkdir command will require you to use the “-p” command option; and
- To show the recursive directory tree, you can use the “-R” command. If you don’t include the “-p” option, then the terminal will show you an error when the directory inside the string doesn’t exist.
Creating multiple directories with the mkdir command can be time-consuming. If you want to avoid this from happening, then you can just run a single mkdir command to build several directories and subdirectories in one go.
More About Linux
Linux is a type of open-source operating system (OS). These are software products that directly manage a system’s own set of software and firmware resources, along with base-level hardware access, such as for your storage devices, RAM modules, CPU chipset, etc.
An OS sits between hardware and applications. It initiates strong connections between all currently connected physical resources and installed software tools that do all of the work in your computer.
Linux is similar to operating systems like Mac OSX and Microsoft Windows, but they’re also different in so many ways. Linux has distributions with full graphical interfaces, though there are versions that are headless and work only in a terminal mode.
Linux has several kinds of software products that are the equivalent of popular applications for other OS platforms. For example, certain text editing tools like Microsoft Notepad has its own equivalent for a variety of Linux distros. Some of these are VI, which is the default text editor in many Linux distros, VIM, Geany, Sublime, and many others.