StarDomain
Tutorials & Guides

SSH for Beginners: Your Gateway to Powerful Hosting Management

Learn how to connect to your server via SSH, navigate the command line, manage files, and perform essential server tasks.

E
Editorial Team
March 31, 2026
9 min read2 views

What is SSH?

SSH (Secure Shell) is a protocol that lets you securely connect to your server's command line from anywhere. Think of it as a remote terminal — everything you can do physically on the server, you can do via SSH.

Why Use SSH?

  • Speed — command-line operations are faster than GUI
  • Power — access to tools not available in cPanel
  • Automation — script repetitive tasks
  • Troubleshooting — read logs, restart services, diagnose issues

Connecting via SSH

On macOS/Linux

Open Terminal and type:

bash
ssh [email protected] -p 22

On Windows

Use Windows Terminal (built-in) or PuTTY:

powershell
ssh [email protected] -p 22

Password authentication works, but SSH keys are more secure:

bash
# Generate a key pair
ssh-keygen -t ed25519 -C "[email protected]"

# Copy public key to server
ssh-copy-id [email protected]

Now you can log in without a password.

Essential Commands

bash
pwd          # Print current directory
ls -la       # List files with details
cd /var/www  # Change directory
cd ..        # Go up one level
cd ~         # Go to home directory

File Operations

bash
cat file.txt     # View file contents
nano file.txt    # Edit file in terminal
cp file.txt backup.txt    # Copy file
mv old.txt new.txt        # Move/rename file
rm file.txt               # Delete file (careful!)
mkdir new-folder          # Create directory

Permissions

bash
chmod 755 directory/   # Set directory permissions
chmod 644 file.txt     # Set file permissions
chown user:group file  # Change ownership

Disk & Memory

bash
df -h           # Disk space usage
du -sh folder/  # Folder size
free -m         # Memory usage
top             # Live process monitor

Web Server

bash
# Apache
sudo systemctl restart apache2
sudo tail -f /var/log/apache2/error.log

# Nginx
sudo systemctl restart nginx
sudo tail -f /var/log/nginx/error.log

Practical SSH Tasks

Compress & Download Files

bash
# Create a tar.gz archive
tar -czf backup.tar.gz public_html/

# Extract an archive
tar -xzf backup.tar.gz

Database Backup via Command Line

bash
# MySQL dump
mysqldump -u username -p database_name > backup.sql

# Restore
mysql -u username -p database_name < backup.sql

Search for Files

bash
# Find files by name
find /home -name "*.php" -type f

# Search file contents
grep -r "error" /var/log/

SSH Config File

Save connection details for quick access:

bash
# ~/.ssh/config
Host myserver
    HostName yourdomain.com
    User username
    Port 22
    IdentityFile ~/.ssh/id_ed25519

Now just type ssh myserver to connect.

Security Tips

  1. Disable password authentication after setting up SSH keys
  2. Change the default SSH port from 22 to something custom
  3. Use fail2ban to block brute-force attempts
  4. Keep your SSH client updated
  5. Never share private keys

Conclusion

SSH is the most powerful tool in a web administrator's toolkit. Start with basic navigation and file operations, then gradually explore more advanced features. Once you're comfortable with the command line, you'll wonder how you ever managed without it.

Share this article
E
Written by

Editorial Team

Our editorial team shares expert knowledge and practical insights to help you succeed online with hosting, domains, and web technology.