It has long since been said that one can do just about anything in Linux. It’s also worth noting that there are often multiple ways of accomplishing things within the Linux environment. Now before getting too deep into this, there are a few things to consider. GUI (graphical user interface) or CLI (command line interface)? Which is best depends on what you’re trying to accomplish. Despite being a long time Linux enthusiast myself, I tend to lean with the GUI as it keeps me grounded. I do however, rely on the CLI for testing or troubleshooting. I also use the CLI for compiling on those occasions where I want to test something in beta. Otherwise my package manger handles the job just fine.
Now that we have all of that out of the way, let’s talk about how to make a directory in Linux. As you might expect, there are two common methods for consideration. Even more, if you consider all of the desktop environments and how they create directories from the GUI. But for the same of this article, let’s just say there are basically two.
Method 1 – CLI) When you open a terminal window within your Linux distribution, you’ll notice that you are already in your home directory. If you’re not convinced, check by typing in ls or dir into the terminal windows, followed by the enter key. You will instantly see files and folders from within that directory itself. For the same of this test, let’s create a new directory within your desktop as to make it appear magically onto your wallpaper. Ready? Type cd Desktop into the terminal window, press enter. Note that desktop must be with a capital D. You will then see something like /Desktop in the terminal. Great, now type this: mkdir LinuxIsAwesome (<–just like that). Boom, there is a new directory created and it appeared out of no where onto your desktop. What about creating a directory within the protected part of your Linux installation? You know, in some place like /opt or something similar? Ah, that will mean you need to run as a super user or sudo. First type cd /opt and then type either sudo mkdir LinuxIsAwesome or su, then mkdir LinuxIsAwesome — which is used depends on the distribution of Linux. Ubuntu for instance would use sudo whereas other distros would use su, then the mkdir command.
Method 2 – GUI) Assuming you are using a desktop environment like GNOME found with Ubuntu, then all you really need to do is locate the area within the existing directory you wish to create a new one. Right click, Create Folder. I believe in KDE it’s the same but labeled as Create Directory. Not 00% on that though. Now for GNOME users (specifically Ubuntu) needing to create a directory within the protected spaces of their Linux installation, you can still use the GUI to make this happen. Press Alt F2 keys, then type gksudo nautilus /path-to-parent-directory and then do the right click, create directory. That is all there is to it.