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.
SSH (Secure Shell) lets you securely connect to your server’s terminal.
ssh username@your-server.com -p 22
For better security, use SSH keys instead of passwords — see SSH Keys vs Passwords.
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:
clear to clean the screen.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.
cp or zip of important files is cheap insurance.rm commands. There’s no recycle bin. Never run rm -rf with variables or wildcards you haven’t verified.pwd before destructive commands.sudo.chmod 777 — it makes files writable by everyone and creates security risks.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
pwd, ls, cd, cp, mv, rm, tail, and grep.We may earn a commission on purchases made through these links, at no extra cost to you.
Don’t miss the chance to participate in the biggest giveaway of this year.