How to Create a New File

When creating your website, you will often need to create additional page files. These may be display file such as html or php, or text files used for reference or configuration.

Although a popular method is to create the folder on your local machine and upload the file to your hosting account, you can also use your File manager or FTP client to log into the account and create the file directly on the server. Below are instructions for simply creating a new file using the cPanel File Manager, the Filezilla FTP client, and the NotePad++ file editor.

Which Option Should I Choose?

If you are brand new to website building, you may not have the Filezilla or Notepad++ software on your computer so the cPanel may be the way to go. Using the cPanel File Manger requires no additional download or configuration, however the FTP and Notepad++ software is better overall as you gain more experience and work with more than one file at a time.

Using the cPanel File Manager

  1. Log into the cPanel
  2. Click the File Manager button, then navigate to the folder where you want to create the file.
  3. Click the +File icon found in the top-left of the toolbar.
  4. After clicking the icon, a popup box will appear for you to name the file. For our example, we name the file test.html. Click on the Create New File button once you name the file.

Using Filezilla FTP client

  1. Open your Filezilla FTP program and connect to your hosting account.
  2. Navigate to the correct folder in the right hand panel. If you are unsure which folder you should be in, use this article to help you decide.
  3. Using the lower-most right hand panel, right-click anywhere in the whitespace and a popup menu will appear. Select the Create New File option.
    create file in filezilla
  4. This brings a popup where you will need to name the file. After naming your file, click on the OK button to save it on the server.
    name new file in filezilla

Using NotePad++ File Editor

  1. Open your NotePad++ program in your desktop.
  2. Connect to the server using FTP function.
  3. Right click in whitespace of the upper FTP panel and click on the Create New File option.
    create new file
  4. You will be prompted to name the file with a popup. Name the file and click on the OK button to save it.
    name and save file

Using Command Line Interface (CLI)

There are many ways to create a file using the Linux command line, but the touch command is one of the easiest.

  1. Connect to your server via SSH.
  2. Navigate to the folder location you want to create the file in.
    cd public_html
  3. You can then create a file using the touch command.
    touch test.html
  4. If you want to verify the file was created, use the “ls -l” command or simply “ll”.
    ll

    You will then see your files in a long list and should see your new file included.
    View if new file created with Linux command line interface
  5. You can then open the file using your preferred editor such as Emacs, Vim, or Nano. Here is an example of using Nano:
    nano test.html
    Viewing new file in the nano editor

Congratulations! You have just created a new file! Obviously, these steps only created a blank file. You may want to check out our article on how to edit a file so you can add some content to your website.

Was this article helpful? Join the conversation!