Last updated: 30 March 2021
You can use cPanel’s file manager for various file-related tasks. Before we dive into some of the options, let’s have a quick look at the interface.
Image: cPanel’s File Manager.
The navigation bar at the top contains two search fields and a settings menu. The search fields are handy if you quickly want to find files. For instance, website errors are often stored in error_log files. Typically, errors are logged in the directory of the script that triggered the error. In other words, you may have more than one error_log file. There could be one in the public_html directory, and another in the directory of a specific WordPress plugin. So, if you are debugging an error then it is useful to do a quick search for any file with the name error_log.
Image: finding files named error_log.
A useful option in the Settings menu is Show Hidden Files (dotfiles). So-called dotfiles are files (or directories) whose name starts with a full stop. These files are mainly configuration files used by the system and are not displayed by default.
In the hosting world, the most famous dotfile is the .htaccess file. This file can be edited to configure things like URL redirection and access control. If you need to edit the file but you can’t see it, selecting “Show Hidden Files” should make it appear.
Image: viewing hidden ‘dotfiles’.
By default, the file manager opens in a new browser tab or window. In our example that is the /home/example folder. The directory you are most likely to be interested in is public_html. This is where, by default, your website files are stored. Two other directories that are worth mentioning are .trash and logs.
The .trash directory is a hidden directory – to see it you need to make sure that dotfiles are displayed. As the name suggests, the directory contains files you have deleted. By default, files you delete are put in the trash, unless you tick a box to permanently delete the file. You can restore items in the trash by right-clicking on the file name and selecting Restore.
The logs directory is used to store logs. These are mainly archived access logs (which shows raw data about website visits) and FTP logs. If you are using a PHP version that uses PHP-FPM then there is also a PHP error log.
If you got a WordPress website then your public_html directory will look similar to the one shown in this image:
Image: The public_html directory, containing a WordPress install.
In the horizontal menu bar, just below the navigation bar, are three options that are enabled: you can create a new file, a new folder or upload a file. When you select a file other options become available: you can copy, move, download, rename, view, edit or delete selected files. You get the same options when you right-click on a file.
Image: A right-click (“contextual”) menu.
In general, these options are useful if you want to quickly perform an action on an individual file. For instance, if you want to make a quick edit to the wp-config.php file then you can copy the file before you edit it (so that you got a backup in case your edit breaks things).
If you want to perform an action on lots of files then there are better tools. For instance, you can use FTP to upload and download files and you can make backups via cPanel’s backup tool.
Note: When you select a file or directory you can also change its permissions. As a rule of thumb, you rarely need to increase file permissions. If, say, you are working on a PHP script and it is not working correctly, increasing the permissions is unlikely to solve the issue – and if it does there is probably another issue.
More importantly, making a script world-executable is a serious security risk. If you are stuck with an error, we’re always happy to have a look.