How To Create, Edit, and Delete a File in CPanel Using File Manager

This tutorial will be useful for you to understand how to create a file, edit a file or delete one. There are times you will want to perform any of these tasks in the course of your work,
You can create, edit and delete files in the file manager section of your website control panel. Now let us take each action separately:

You will also want to read:

CPanel Security
CPanel Login Tutorial
CPanel Account Information Tutorial
Backup mysql database tutorial
I have a full backup of account through cPanel. How do I restore it?

To create a file through file manager, please do the following:

    Login to cPanel.

Once you are authenticated and successfully login to your website control panel, you will need to click on Filemanager. The Filemanager link will be found under the “files” category.
    Choose to open Web Root and Show hidden files.
    Click the New File or New Folder button at the top of the page.
   
In the pop-up box, enter a name for the new file or folder. (Files will have a name and extension separated by a dot, but folders have only the one name.)
    Click the Create New File or Create New Folder button to complete the process.
   To create a new folder:

The process is essentially the same with new file creation. The only difference is that you will have to click the “create new folder” button at the top of the page to create a new folder.
    In the pop-up box, enter a name for the new folder. (folders have only the one name.)
    Click the Create New Folder button to complete the process.


To modify your files through File Manager.
    Please do the following:    Login to cPanel with the authentication requirements.
Click on filemanager in the cPanel section of your website control panel. Next, click root and Show hidden files - this will allow you access to hidden system files which ordinarily will not be displayed if this option is not checked.

Another safe method is to download the file you intend to modify to your local computer. This can be done by highlighting the file by taping it and then clicking the download button from the top menu bar. You can then open the file with a text editor lie "context editor" or notepad and then proceed to edit it. Once you finish and save your changes, you can use the filemanager upload button to re-upload to the same directory, overwriting the existing file.

   
Next, you need to locate the file. To do this, you need to trace the file you want to alter and check the box next to it.
    You have several options at the top: copy, move, delete, edit. Click the option you want.

Also read:
Cannot See My Website Online After Upload, Why?
Character encoding in cPanel file manager
Custom error page is not working
Default Home Directory Folders
Getting Familiar With the cPanel User Environment


To be able to delete a file using the cPanel filemanager, you will need to highlight the file you want to delete and click the delete button

To edit a file, you will check the box next to the file you want to edit and click the edit button. You can choose to edit as text or use the code view. The major advantage of the code view is that it allows you to search a particular text and locate the section you may want to edit quite easily.


Remember to save your work once you are done with editing.

File Manager editors

Filemanager editor allow you to make immediate changes to your web site without the need to upload a new version of the file. cPanel has three editors that you can use to edit files directly on the web server:

    A plain text editor for editing text files. This editor is intended for use with plain text files, such as configuration files.
    A Code Editor for editing files that contain code. This editor is intended for use with PHP files, JavaScript files, CSS files, and so on. It provides common code editing features such as syntax highlighting and line numbering.
    An HTML Editor that is intended for use with HTML files. This editor provides WYSIWYG (What You See Is What You Get) functionality. It provides many of the features that users of word processing programs are familiar with, such as spell check, formatting toolbars, and so on.

In most modern servers running on cPanel WHM Version 64.0.22 and above, the HTML editor has been depreciated and no longer available. The code editor and html editor functions have been built into the text editor function.

Viewing a file

You may not always need to edit a file. If you just want to have a quick look at a file's contents, you can view it without opening an editor.

To view a file in File Manager, follow these steps:

    In the File Manager main window, select the file that you want to view.
    Click the View icon. The file's contents appear in a new page.

Also read:

 How Do I Create and Delete a Parked Domain
How do I create and remove an Addon Domain?
How to Backup My Website in cPanel
How to Create a MySQL Database, a User and Delete Database in Cpanel


Editing a file using the text editor

To edit a text file, follow these steps:

    In the File Manager main window, select the file that you want to edit.
    Click the Edit icon.
    Click Edit. The file's contents appear in a new page, ready for editing.
    Save your changes when you are done, click Save Changes.
    To close the editor, click Close


What if the file you want to edit is zipped?

To edit a file that is zipped, you will first need to unzip the file and proceed to open the folder, locate the file you intend to edit and proceed with your editing.
   That is it. You now know how to edit, create or delete a file in File Manager.


How to locate and edit hidden/system files

Hidden or system files are ordinarily not visible when you access filemanager exept you check the box which enables you to view them. A good example of a very useful system/hiddenfile is the .htaccess file.

Let's now look at how to edit these files.

Under Linux, the files starting with dot (.) are hidden system files.

They can be edited in two ways:

1. Access the file with File Manager - open cPanel -> File manager or Legacy File Manager. Click on the gear icon at the top right corner, a new window will appear. There you should select the radio button for "home directory" and check the  "show hidden files" box. After that you should be able to view/edit the chosen hidden file.

2. The alternative method for editing your hidden files is by using the edit functionality included in your FTP client, for example FileZilla.

3. If running on the paper_lantern theme in cPanel, you will have to open file manager and then from the top right, you clic on the gear button then select "show hidden files".


There are cases where the hidden files do not show up. Never worry,just go to file manager, click the gear icon by the top right and in the window that show up, click on "show hidden files". This is applicable with the cPanel "paper_lantern" theme which is currently the default theme in cpanel.

 Searching for files in FileManager

You can use the cPanel File Manager to search for a particular file or set of files. For example, you can search for all files that have the word "hosting" in their filenames.

To search for a file, follow these steps:

    In the top-right corner of the File Manager main window, select the location to search for the file in the Search list box. You can search for files in the following locations:
        In all of your files (that is, in your home directory and in all subdirectories beneath it).
        In only your public_html directory.
        In the current directory.

    In the text box, type the name of the file that you want to find, and then click Go.


Uploading a file with the cpanel file manager

You will often need to uplaod files to your account in the course of managing your website or building a new one with different programs. This can be done via FTP, or via the cPanel File Manager. In this article, we will show you how to upload a file using the cPanel File Manager tool.

    Log into the cPanel dashboard.

    From the main cPanel screen, look for the Files category and then click on the File Manager icon.
    click upload icon

    This brings up a popup screen to select which area of the File Manager you want to begin. We are going to select the Web Root, which is the root folder for your primary domain. The name of the folder is public_html. Once you select your destination, click on the Go button.

    choose directory file
    This brings you to the files inside the directory you selected, in our case, the public_html folder. Across the top of the screen is a toolbar with various options. Find and click on the Upload icon.

    This screen is the Upload Files area. To begin the upload, click on the Browse button.
    click browse button

    Now a popup will appear for you to locate the file on your local computer. Once you find the desired file, click on the Open button to begin the upload.
    select local file.
  • 45 Users Found This Useful
Was this answer helpful?

Related Articles

I have a full backup of account through cPanel. How do I restore it?

It is recommended that you maintain healthy backup of your website and possibly download the...

How to Create a MySQL Database, a User and Delete Database in Cpanel

Your cPanel allows you to easily create a MySQL database, create database users, and assign...

How do I create and remove an Addon Domain?

An add-on domain is a separate domain name that you add to your web hosting subscription with...

How to Set Up and Delete a Cron Job

A cron job allows you to run a certain command at times set by the job. For example, you could...

How Do I Create and Delete a Parked Domain

Parked domains are additional domains which you host on your account. They will display the same...

Powered by WHMCompleteSolution