Site icon Hostreta

Terminal Basics Every Website Owner Should Know

Terminal Basics – Terminal Basics Every Website Owner Should Know

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

Connecting with SSH

SSH (Secure Shell) lets you securely connect to your server’s terminal.

  1. Enable SSH access in your hosting panel (some shared hosts require you to turn it on).
  2. Find your SSH host, username, and port (the default port is 22; some hosts use another).
  3. 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:

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

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

Exit mobile version