If you’re new to managing a VPS (Virtual Private Server), SSH commands might seem intimidating at first. But don’t worry — this guide breaks them down into simple, practical instructions so you can feel confident working directly on your server.
Whether you’re a developer deploying a website or just exploring server-side development, these SSH basics will help you get comfortable fast.
What Is SSH (Secure Shell)?
SSH stands for Secure Shell, a cryptographic network protocol used to securely access and manage servers over the internet.
Think of it like opening a secure command-line window into your server. Instead of clicking through a control panel, you can directly issue instructions, automate tasks, and troubleshoot problems in real-time.
Why use SSH?
- Encrypted communication between your computer and the server
- Remote control of your server from anywhere
- Efficient task management, especially for developers and sysadmins
🚀 How to Connect to Your VPS via SSH
Before using any commands, you need to connect to your VPS.
On Windows:
- Open PowerShell or Command Prompt
Run:
ssh username@your-server-ip
- Replace username and your-server-ip with your credentials.
On Mac/Linux:
- Open the Terminal
Use the same command:
ssh username@your-server-ip
Custom Port (Optional):
If your VPS provider uses a non-standard port (for security), connect like this:
ssh -p 2222 username@your-server-ip
Pro Tip: Use SSH Keys
SSH keys let you log in without typing your password each time and are more secure. You can generate them using:
ssh-keygen
Then add the public key to your server. Most hosting providers, like CreativeON, support this method.
🗂️ Navigating the Server
cd — Change Directory
cd public_html # Move into your website folder
cd .. # Go up one directory
cd ~ # Jump to your home directory
pwd — Show Current Path
pwd
# Output example: /home/yourusername/public_html
ls — List Files
ls # List files and folders
ls -a # Include hidden files
ls -l # Detailed list with permissions
📁 File and Folder Management
mkdir — Make Directory
mkdir my-project
touch — Create Empty File
touch index.html
cp — Copy Files or Folders
cp old.txt new.txt # Copy file
cp -R folder1 backup-folder1 # Copy directory recursively
mv — Move or Rename
mv file.txt folder/file.txt # Move
mv oldname.txt newname.txt # Rename
rm — Delete Files or Folders ⚠️
rm file.txt # Delete file
rm -r old-folder # Delete folder and its contents
Caution: Files deleted with rm are not recoverable.
📄 Viewing and Editing Files
cat — View File Contents
cat wp-config.php
cat file1.txt file2.txt > combined.txt
less — View Large Files Scrollably
less biglog.log
# Use space to scroll, ‘q’ to quit
nano — Edit Text Files (Beginner-Friendly)
nano index.html
vi or vim — Advanced Text Editor
vim index.html
(For advanced users only. Start with nano if you’re new.)
🔍 Searching and Finding Files
find — Locate Files
find /home -name “*.log”
find . -size +100M # Files over 100MB
grep — Search Inside Files
grep “DB_NAME” wp-config.php
grep -r “SearchTerm” /var/www
📦 Working With Archives & Downloads
tar — Archive and Extract
tar -cvzf backup.tar.gz public_html # Create archive
tar -xvzf backup.tar.gz # Extract archive
wget — Download Files
wget https://wordpress.org/latest.tar.gz
wget -c https://wordpress.org/latest.tar.gz # Resume download
💾 Checking Disk and System Usage
du — Disk Usage
du -sh public_html # Folder size
du -h /home # Summary of all folders
df — Free Space
df -h # Human-readable disk space report
🧠 Process Management and Scheduling
ps — Show Running Processes
ps aux
ps aux | grep apache
history — Command History
history
!25 # Rerun command #25
history | grep rm # Search for previous delete actions
crontab — Schedule Repeating Tasks
crontab -e # Edit cron jobs
crontab -l # List existing jobs
Use this for tasks like automated backups or updates.
🙋 Common FAQs
Yes, SSH encrypts all communication and is safer than FTP or Telnet.
Not if you’re careful. Avoid rm -r unless you’re sure what you’re deleting.
No. VPS and dedicated servers usually do. Shared hosting might not. Check with your provider.
Use the manual:
man command
# Example: man ls
Final Thoughts
SSH is a powerful tool once you get the hang of it. Whether you’re running a VPS in Pakistan through providers like CreativeON or managing servers abroad, knowing SSH makes your life easier.
You don’t have to memorize everything. Bookmark this guide and revisit it whenever you need to recall a command.