In this guide: Linux terminal basics for website owners: connecting with SSH, navigation commands, file commands, permissions, WP-CLI, and safe practices.
You don’t need to be a developer to benefit from the command line. Many hosting tasks — moving files, fixing permissions, running WordPress updates, or checking logs — are faster in the terminal than in a web interface. Here are the essential commands every website owner should know.
Why use the terminal
- Speed: move, copy, or search thousands of files in seconds.
- Power: tasks that web panels can’t do, like bulk search-and-replace or scripted backups.
- Troubleshooting: read error logs and check disk usage directly.
- WP-CLI: manage WordPress from the command line — update plugins, create users, clear caches.
- VPS management: on a VPS, the terminal is often the main interface.
Connecting with SSH
SSH (Secure Shell) lets you securely connect to your server’s terminal.
- Enable SSH access in your hosting panel (some shared hosts require you to turn it on).
- Find your SSH host, username, and port (the default port is 22; some hosts use another).
- Connect from your computer:
– Mac/Linux: open Terminal.
– Windows: use Windows Terminal/PowerShell (includes OpenSSH) or a client like PuTTY.
ssh username@your-server.com -p 22
For better security, use SSH keys instead of passwords — see SSH Keys vs Passwords.
Navigation commands
pwd # print working directory (where am I?)
ls # list files
ls -la # list all files, including hidden, with details
cd public_html # change directory
cd .. # go up one level
cd ~ # go to your home directory
Tips:
- Press Tab to autocomplete file and folder names.
- Press the Up arrow to repeat previous commands.
- Use
clearto clean the screen.
File commands
cat file.txt # show file contents
less error_log # scroll through a long file (q to quit)
tail -n 50 error_log # show the last 50 lines (great for logs)
tail -f error_log # follow a log live as errors appear
nano wp-config.php # edit a file in a simple editor
cp file.txt backup.txt # copy a file
cp -r folder/ backup/ # copy a folder
mv old.txt new.txt # move or rename
mkdir new-folder # create a directory
rm file.txt # delete a file (permanent!)
rm -r folder/ # delete a folder (careful!)
Searching:
grep -r "search text" . # find text in files
find . -name "*.php" -mtime -2 # PHP files changed in the last 2 days (useful after a hack)
du -sh * # size of each folder (find what uses disk space)
df -h # disk usage summary
Archives:
zip -r site-backup.zip public_html/
unzip archive.zip
tar -czf backup.tar.gz public_html/
tar -xzf backup.tar.gz
Permissions (common WordPress defaults):
find . -type d -exec chmod 755 {} \; # folders
find . -type f -exec chmod 644 {} \; # files
chmod 600 wp-config.php # stricter for config (check your host's recommendation)
WP-CLI (if installed — many hosts include it):
wp core version
wp plugin list
wp plugin update --all
wp cache flush
wp search-replace 'http://old.com' 'https://new.com' --dry-run
wp user create editor1 editor@example.com --role=editor
Always run search-replace with --dry-run first, and back up the database before the real run.
Safe practices
- Back up before changing anything. A quick
cporzipof important files is cheap insurance. - Double-check
rmcommands. There’s no recycle bin. Never runrm -rfwith variables or wildcards you haven’t verified. - Know where you are — run
pwdbefore destructive commands. - Avoid running as root unless necessary; on VPS, use a normal user with
sudo. - Never use
chmod 777— it makes files writable by everyone and creates security risks. - Test on staging when running bulk operations.
- Log out when finished:
exit.
Start small: connect via SSH, navigate to your site folder, and read your error log. That alone will make you a better troubleshooter.
Further reading: MDN Web Docs learning area
Key Takeaways: Terminal Basics
- SSH gives you secure access to your server’s terminal.
- Learn
pwd,ls,cd,cp,mv,rm,tail, andgrep. - WP-CLI makes WordPress management fast.
- Back up first, verify destructive commands, and never use 777 permissions.

