Project Kickoff: Provisioning Web Server Directories
Learn how to structure your web server project using the mkdir command. Master directory creation and organization to build a clean, production-ready foundation.

Previously in this course, we covered The ls command: listing and inspecting files in Linux. Now that you can inspect what is already on your system, it’s time to take control of your environment by creating your own organized workspace.
In professional infrastructure, you never dump files into your home directory. Clean project setup is the first step toward a maintainable, hardened web server. Today, we’ll create the directory structure for our project, ensuring our logs and web content are separated and secure.
The Foundation of Organization: The mkdir Command
The primary tool for creating directories in Linux is mkdir (short for "make directory"). It is a simple but powerful command that allows you to establish the hierarchy of your application.
When we build a web server project, we don't just create a single folder. We follow a standard convention that separates code from data. A typical structure for our project will look like this:
TEXT/home/user/web-server-project/ ├── content/ # Static files (HTML, CSS, Images) └── logs/ # Server access and error logs
By separating content from logs, we make it easier to manage permissions later (e.g., giving the web server read access to content but write access only to logs).
Provisioning Your Project Structure

To get started, open your terminal. We will create our project root and the required subdirectories in one go.
1. Creating the Root
First, navigate to your home directory if you aren't there already:
Bashcd ~
Now, create the root folder:
Bashmkdir web-server-project
2. Creating Subdirectories
You can create the internal folders by navigating into the root first, or by using paths directly. To be efficient, we can create both at once:
Bashmkdir web-server-project/content web-server-project/logs
3. Using the -p Flag
If you ever need to create a nested directory structure (like web-server-project/logs/archive), standard mkdir might fail if the parent doesn't exist. Use the -p (parents) flag to create the entire path automatically:
Bashmkdir -p web-server-project/logs/archive
Worked Example: Verifying Your Work
It is a best practice to verify your work immediately after running commands. Use ls -R (recursive list) to see the entire tree you just built:
Bashls -R web-server-project
Expected Output:
TEXTweb-server-project: content logs web-server-project/content: web-server-project/logs: archive web-server-project/logs/archive:
Hands-on Exercise
- Create a directory named
my-web-appin your home folder. - Inside
my-web-app, create two subdirectories:publicandprivate. - Use
ls -Fto list the contents ofmy-web-app. Note how the trailing slashes indicate they are directories.
Common Pitfalls
- Permission Denied: If you try to create a folder in a protected system path (like
/var/wwwinstead of your home folder), you will get a "Permission denied" error. Always build your projects in your home directory unless you are working with root privileges. - Spaces in Names: Avoid spaces in directory names (e.g.,
mkdir web server). Use hyphens or underscores instead (web-serverorweb_server). Spaces require escaping with backslashes or quoting, which makes CLI operations unnecessarily complex. - Case Sensitivity: Remember that Linux is case-sensitive.
mkdir Dataandmkdir dataare two entirely different directories. Stick to lowercase to avoid headaches.
Frequently Asked Questions
Q: Can I create multiple directories at once?
A: Yes, mkdir dir1 dir2 dir3 will create all three in the current location.
Q: What happens if I try to create a directory that already exists?
A: mkdir will return an error message saying "File exists". Use mkdir -p if you want the command to be "silent" and succeed regardless of whether the directory already exists.
Q: Should I use mkdir with sudo?
A: Only if you are creating directories in system-wide locations (like /opt or /var). For personal projects, work in your home directory where you own the files.
Recap
We have successfully initialized our project root, structured our content and log directories, and learned the power of the -p flag for recursive creation. This structure is essential for the later stages of our server setup, similar to how we might initialize a Setting Up the Project Environment: A Professional Foundation for larger applications.
Up next: We will learn how to populate these directories by creating and removing files using touch and rm.
Work with me

VPS Server Setup, Deployment & Hardening
Get your app live on a fast, secure server — properly configured, hardened, and deployment-ready. No more wrestling with the command line.

Next.js Full-Stack Web App Development
A fast, SEO-ready full-stack web app built with Next.js 16 — from idea to deployed product, by an engineer who ships to production.
