- Login to your cPanel account.
- Navigate to your root directory (public_html) and create a new File.
- Type any suitable name with the .php extension, and hit the Create New File button.
- Right click over the created PHP file and then Edit.
- Copy the below given code and paste it there.
<?php $output = shell_exec('df -h'); echo "<pre>$output</pre>"; ?>
*You can use any shell command in the bracket().
- Click over Save Changes to save the code.
- Now, visit the file from the outside as URL as, www.domainname.com/file.php
You can also check the blog to run various shell commends using php file in cPanel.