Using the cPanel Terminal (Command Line)
Last Updated: 2025-01-01
3 min read
cPanel includes a built-in web-based terminal that provides command-line access to your hosting account directly from your browser. This is a convenient alternative to connecting via a dedicated SSH client, especially for quick tasks.
Accessing the cPanel Terminal
- Log in to cPanel.
- Navigate to the Advanced section.
- Click on Terminal.
- Accept the terms of use (first time only).
A terminal window opens in your browser, connected to your hosting account’s home directory.
What You Can Do
The cPanel terminal gives you access to a Linux command-line environment. Common tasks include:
File Management
ls -la # List files with details
cd public_html # Change directory
cp file.txt backup.txt # Copy a file
mv old.txt new.txt # Rename/move a file
rm unwanted.txt # Delete a file
find . -name "*.log" # Search for files
du -sh * # Check folder sizes
Text Editing
nano filename.txt # Edit a file with nano
cat filename.txt # View file contents
head -50 error_log # View first 50 lines
tail -100 access_log # View last 100 lines
grep "error" logfile.txt # Search within a file
Database Operations
mysql -u username -p # Connect to MySQL
mysqldump -u username -p database_name > backup.sql # Export database
WordPress CLI (if available)
wp core version # Check WordPress version
wp plugin list # List installed plugins
wp cache flush # Clear WordPress cache
wp search-replace 'old' 'new' # Search and replace in database
Compression
tar -czf backup.tar.gz public_html/ # Create compressed archive
tar -xzf backup.tar.gz # Extract archive
zip -r backup.zip public_html/ # Create zip archive
unzip backup.zip # Extract zip archive
Limitations Compared to SSH
While the cPanel terminal is convenient, it has some limitations compared to a full SSH connection:
| Feature | cPanel Terminal | SSH Client |
|---|---|---|
| Access method | Browser-based | Dedicated client (PuTTY, OpenSSH) |
| Session persistence | Closes when browser tab closes | Can run persistent sessions (screen/tmux) |
| Session timeout | Times out with cPanel session | Configurable timeout |
| Root access | No | No (on shared hosting) |
| Long-running commands | May timeout | Better suited for extended operations |
| File transfer | Not supported | SCP/SFTP available through SSH |
| Key-based auth | Not applicable | Supported |
Important Notes
- The cPanel terminal runs under your cPanel user account — you do not have root access.
- Commands that require elevated privileges (
sudo,apt-get,yum) are not available on shared hosting. - Be careful with destructive commands like
rm -rf— there is no undo. - If the terminal is not visible in your cPanel, your hosting provider may have disabled it. Contact their support team to inquire about access.
- For long-running processes, use a proper SSH connection with
screenortmuxto prevent disconnection issues. - The terminal respects your hosting account’s resource limits — resource-intensive commands may be terminated by the server.
The cPanel terminal is a powerful tool for quick command-line tasks without needing a separate SSH client. For more complex operations or long-running processes, consider setting up a proper SSH connection.
Tags:
cpanel
hosting
terminal
command-line
ssh