Quick check on essential Linux commands for VPS: Practical guide to SSH connection, file management, and permission control

โ„น๏ธ

Disclosure: This article may contain affiliate links. If you purchase through these links, we may earn a small commission at no additional cost to you. All reviews are independently written and opinions remain unbiased.Learn more โ†’

๐Ÿ’ก AD: DigitalOcean $200 Free Credit (60 Days) Claim via Our Link โ†’
๐Ÿ’ก

Vultr โ€” Editor's Pick

Get the best price through our exclusive link and support our reviews.

Explore Vultr โ†’

When beginners get their first VPS and SSH into it for the first time, many feel the same way: a black screen, a blinking cursor, and no idea what to do next. The good news is that Linux commands arenโ€™t as scary as they look. For day-to-day VPS management, you only need about 30โ€“40 commands regularly. Everything else you can look up when you need it.


SSH Connection

The most basic way to connect:

ssh root@your-server-ip

The first time you connect, youโ€™ll see a fingerprint confirmation prompt. Just type yes and press Enter. After that, it wonโ€™t ask again for this server.

If your provider uses a non-standard port (or youโ€™ve already changed the SSH port โ€” which I strongly recommend), add the -p flag:

ssh -p 2222 root@your-server-ip

Using SSH key authentication is much more secure than passwords. The private key stays on your local machine, and only the public key lives on the server โ€” making brute-force attacks almost useless.

# Generate a key pair on your local machine
ssh-keygen -t ed25519

# Copy the public key to the server
ssh-copy-id -p 2222 root@your-server-ip

# Connect using the key
ssh -i ~/.ssh/id_ed25519 -p 2222 root@your-server-ip

Once key login is working, I recommend editing /etc/ssh/sshd_config and setting PasswordAuthentication no to completely disable password login.


File and Directory Operations

These commands are used almost every day:

ls                  # List files in current directory
ls -lh              # List with human-readable sizes and details
cd /var/www         # Go to a specific directory
cd ..               # Go up one level
cd ~                # Go back to your home directory
pwd                 # Show current path

Creating and deleting:

mkdir myapp          # Create a directory
mkdir -p a/b/c       # Create nested directories
touch config.env     # Create an empty file
rm file.txt          # Delete a file
rm -rf folder/       # Delete a folder and everything inside (irreversible โ€” use with extreme caution)

rm -rf is the command that trips up most beginners. Always double-check the path before running it, especially if it contains variables. One wrong move and you could accidentally delete your entire system.

Copying and moving:

cp file.txt backup.txt          # Copy a file
cp -r folder/ backup_folder/    # Copy an entire directory
mv file.txt /home/user/         # Move a file
mv oldname.txt newname.txt      # Rename a file

Viewing file contents:

cat config.txt                    # Display the entire file
less config.txt                   # View with paging (press q to quit)
tail -f /var/log/nginx/error.log  # Follow log file in real time
grep "error" app.log              # Search for a keyword in a file

tail -f is one of the most useful commands when troubleshooting. Open one terminal to watch the logs live while you make changes in another โ€” youโ€™ll immediately see exactly where things go wrong.


Permissions

Use ls -l to check file permissions:

ls -l /var/www/html
# Example output:
# -rw-r--r-- 1 www-data www-data 1234 index.html

The string -rw-r--r-- shows permissions for owner, group, and others. Each group uses r (read=4), w (write=2), x (execute=1).

Change permissions with chmod:

chmod 755 deploy.sh      # Owner can read/write/execute, others can read/execute
chmod 644 config.txt     # Owner can read/write, others can only read
chmod -R 755 /var/www    # Apply recursively to a whole directory

Quick reference: Use 755 for scripts and directories, 644 for normal files, and 600 for private keys.

Change ownership with chown:

chown www-data:www-data /var/www/html
chown -R www-data:www-data /var/www     # Recursive

Nginx and Apache usually run as the www-data user. If website files donโ€™t belong to the correct user, youโ€™ll get 403 Forbidden errors โ€” one of the most common pitfalls when new users deploy WordPress.


Process and System Management

Monitor system resources:

top               # Real-time CPU and memory (press q to quit)
htop              # Nicer version (install with: apt install htop)
ps aux            # List all running processes
ps aux | grep nginx   # Find a specific process

Kill processes:

kill 1234         # Graceful termination
kill -9 1234      # Force kill immediately
pkill nginx       # Kill by process name

Check which ports are in use (useful when you see โ€œport already in useโ€ errors):

ss -tulpn
# or
netstat -tulpn    # requires net-tools package

Check disk and memory usage:

df -h             # Disk usage
du -sh /var/www   # Size of a specific directory
free -h           # Memory usage

Software Installation (Ubuntu/Debian)

apt update              # Refresh package list
apt upgrade -y          # Upgrade all installed packages
apt install nginx -y    # Install a package
apt remove nginx        # Remove a package
apt autoremove          # Clean up unused packages

Search for packages:

apt search nginx

Service Management (systemd)

Modern Linux uses systemd to manage services:

systemctl start nginx     # Start
systemctl stop nginx      # Stop
systemctl restart nginx   # Restart
systemctl reload nginx    # Reload config without dropping connections
systemctl enable nginx    # Enable auto-start on boot
systemctl disable nginx   # Disable auto-start
systemctl status nginx    # Check service status

systemctl status is usually the first command you run when something isnโ€™t working โ€” it shows whether the service is running, recent log output, and exit codes.

View detailed logs:

journalctl -u nginx              # Full logs for a service
journalctl -u nginx -f           # Follow logs in real time
journalctl -u nginx --since "1 hour ago"   # Logs from the last hour

Network Troubleshooting

ping google.com               # Test connectivity (Ctrl+C to stop)
curl -I https://example.com   # Show HTTP response headers
wget https://example.com/file.tar.gz   # Download a file
ip a                          # Show network interfaces and IP addresses

Trace routes (helpful for diagnosing network issues):

traceroute google.com
mtr google.com                # Better real-time version

Productivity Tips

Press Tab to auto-complete commands and paths โ€” this habit saves a huge amount of time and prevents typos.

Use the up/down arrow keys to browse command history. Type history to see all previous commands, or !1234 to re-run command number 1234.

Keyboard shortcuts:

  • Ctrl + C โ€” interrupt the current command
  • Ctrl + Z โ€” suspend the current command to background
  • fg โ€” bring the suspended command back to foreground

Use the pipe | to combine commands:

# Show top 5 processes by memory usage
ps aux --sort=-%mem | head -5

# Live filter logs for errors
tail -f /var/log/nginx/error.log | grep "error"

# Count files in a directory
ls /var/www | wc -l

Quick Command Cheat Sheet

TaskCommand
Connect to serverssh root@IP
List directory contentsls -lh
Change directorycd /path
Delete file/folderrm file or rm -rf folder
Change permissionschmod 755 file
Change ownerchown user:user file
Monitor resourceshtop or top
Check open portsss -tulpn
Check disk usagedf -h
Install softwareapt install xxx -y
Manage servicessystemctl start/stop/status
Follow logs livetail -f logfile

You donโ€™t need to memorize everything at once. Look up the command when you need it, and after using it a few times it will stick naturally. The real skill isnโ€™t remembering every flag โ€” itโ€™s knowing which command to reach for when you run into a problem.

๐Ÿš€

Ready for Vultr? Now is the perfect time

Use our exclusive link for the best price โ€” and help support our content.

๐Ÿ”ฅ Limited Offer๐Ÿ”ฅ Claim Vultr Deal โ†’
โ† Previous
Hosting.com 2026 Review: Still Fast, But Watch These Things (ex-A2 Hosting)

๐Ÿท๏ธ Related Keywords

๐Ÿ’ฌ Comments

150 characters left

No comments yet. Be the first!

โ† Back to Articles