Pre-requirements
- Access to your cPanel account or SSH for command line usage.
- Basic understanding of file creation in cPanel or Linux command line.
Creating a New File 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 file using the File Manager:
- Scroll down to the Files section and click on the File Manager icon.
- In the toolbar, click + File to open the file creation interface.
- Enter the desired file name in the New File Name text box (e.g., example.txt).
- Specify the location where the file should be created in the New file will be created in: text box. If you're unsure, the default location is usually public_html.
- Click Create New File to finalize the process.
Gotchas to Avoid
- Ensure the file is created in the correct directory, especially when working with public_html or other critical directories.
- Use meaningful file names that reflect the purpose of the file.
Creating a New File Using the Command Line (SSH)
If you prefer to use the command line, here are the steps to create a new file via SSH:
Step 1: Check Your Current Location
First, ensure that you are in the correct directory. To check your current location, use the following command:
pwd
The pwd command prints your working directory, showing you the directory you are currently in. You can also use:
echo $PWD
Step 2: Create a New File
To create a new file, use any of the following commands (choose based on your preferred text editor):
vi filename.txt
vim filename.txt
nano filename.txt
Step 3: Create Multiple Files
If you need to create multiple files at once, you can use the touch command:
touch file1.txt file2.txt file3.txt
Gotchas to Avoid
- Ensure you're in the correct directory before creating files, especially when working in critical system directories like public_html.
- Be cautious when using command-line editors like vi, vim, or nano if you're unfamiliar with their usage. Make sure to save the file after editing.
Creating files in cPanel or via the command line is a simple task, whether you're using the graphical interface of File Manager or command-line tools like vi, nano, or touch. Be sure to specify the correct directory and file name to avoid issues later. If you're using SSH, verify your current working directory with pwd to avoid confusion.
If you want to add to this tutorial or have found an error in it, please send an email to team+editorial@webhostingm.com