Pre-requirements
- Access to your cPanel account or SSH for command line usage.
- Basic understanding of folder creation in cPanel or Linux command line.
Creating a New Folder Using cPanel File Manager
Once you have successfully created a web hosting account and logged in to your cPanel account, follow these steps to create a new folder using the File Manager:
- Scroll down to the Files section and click on the File Manager icon.
- In the toolbar, click + Folder to open the folder creation interface.
- Enter the desired folder name in the New Folder Name text box (e.g., new_folder).
- Specify the location where the folder should be created in the New folder will be created in: text box. The default location is usually public_html, but you can change it to any directory of your choice.
- Click Create New Folder to complete the process.
Gotchas to Avoid
- Make sure to double-check the folder's location, especially when working in directories like public_html or other critical areas.
- Use a meaningful and descriptive folder name to keep your file structure organized.
Creating a New Folder Using the Command Line (SSH)
If you prefer to use the command line, here's how to create folders using SSH:
Step 1: Check Your Current Location
Before creating a folder, ensure that you're in the correct directory by using the pwd command:
pwd
The pwd command displays the current directory you're working in. You can also use:
echo $PWD
Step 2: Create a Folder
To create a folder in the current directory, use the mkdir command:
mkdir folder_name
Step 3: Create Multiple Folders
To create multiple folders at once, use the mkdir command followed by the folder names separated by spaces:
mkdir folder1 folder2 folder3
Step 4: Create Nested Directories
To create nested directories, use the -p flag, which ensures that the parent directories are created if they don't already exist:
mkdir -p parent_folder/child_folder/nested_folder
Gotchas to Avoid
- Be careful when using the mkdir command in system-critical directories. Make sure you are in the correct directory before creating folders.
- Use the -p flag to avoid errors when creating nested directories if the parent folder doesn't exist yet.
Creating folders in cPanel or via the command line is a simple and essential task for managing your web hosting file structure. Whether you use the File Manager for a visual approach or the command line for more advanced tasks, make sure you're in the correct directory and use meaningful folder names to keep your files organized.
If you want to add to this tutorial or have found an error in it, please send an email to team+editorial@webhostingm.com