On this page
terminal
Essential Linux Commands for VPS Users
A practical reference of the most useful Linux commands for managing your GoZen VPS: files, processes, networking, disk, and system monitoring.
If you’re managing a GoZen VPS for the first time, the command line can feel overwhelming. This is a practical reference of the commands you’ll actually use day-to-day. Bookmark this page.
File & Directory Basics
# List files (with details and hidden files)
ls -la
# Change directory
cd /var/www/html
cd ~ # go to home directory
cd .. # go up one level
# Create directories
mkdir mysite
mkdir -p /var/www/mysite/public_html # create nested directories
# Copy files and folders
cp file.txt backup.txt
cp -r /var/www/site1 /var/www/site1-backup # copy directory recursively
# Move / rename
mv oldname.txt newname.txt
mv /tmp/file.txt /var/www/html/
# Delete
rm file.txt
rm -rf directory/ # delete directory and everything inside (careful!)
# Find files
find / -name "php.ini" # search entire system
find /var/www -name "*.log" -size +100M # find logs over 100MB
Viewing & Editing Files
# View file contents
cat file.txt # print entire file
less file.txt # scrollable viewer (press q to quit)
head -50 file.txt # first 50 lines
tail -50 file.txt # last 50 lines
tail -f /var/log/syslog # follow log in real time
# Edit files
nano file.txt # simple editor (Ctrl+O to save, Ctrl+X to exit)
vim file.txt # powerful editor (press i to insert, Esc then :wq to save and quit)
File Permissions
# View permissions
ls -la file.txt
# Example output: -rw-r--r-- 1 www-data www-data 1234 Apr 1 12:00 file.txt
# Change ownership
chown www-data:www-data file.txt
chown -R www-data:www-data /var/www/html/ # recursive
# Change permissions
chmod 644 file.txt # owner read/write, group read, others read
chmod 755 directory/ # owner full, group read/execute, others read/execute
chmod -R 755 /var/www/html/
# Common WordPress permissions
find /var/www/html -type d -exec chmod 755 {} \; # directories
find /var/www/html -type f -exec chmod 644 {} \; # files
Disk Usage
# Overall disk usage
df -h
# Directory sizes
du -sh /var/www/* # size of each item in /var/www
du -sh /home/*/ # size of each user's home directory
# Find the 10 largest files
find / -type f -exec du -h {} + 2>/dev/null | sort -rh | head -10
# Find the 10 largest directories
du -h --max-depth=1 / 2>/dev/null | sort -rh | head -10
Process Management
# List running processes
ps aux # all processes
ps aux | grep nginx # find specific process
top # live process monitor (press q to quit)
htop # better version of top (install: apt install htop)
# Kill a process
kill 12345 # graceful stop (replace with PID)
kill -9 12345 # force kill
# Check what's using a port
ss -tlnp # list all listening ports
lsof -i :80 # what's on port 80?
lsof -i :443 # what's on port 443?
System Information
# System details
uname -a # kernel version
lsb_release -a # Ubuntu/Debian version
cat /etc/os-release # OS info
# Hardware
nproc # number of CPU cores
free -h # memory usage
uptime # how long the server has been running
# Who's logged in
who
last -10 # last 10 logins
Networking
# Test connectivity
ping -c 4 google.com # 4 pings to test internet
curl -I https://yourdomain.com # check HTTP headers
# DNS lookup
dig yourdomain.com # full DNS lookup
dig yourdomain.com A # just A records
dig yourdomain.com MX # mail records
nslookup yourdomain.com # simpler DNS lookup
# Download files
wget https://example.com/file.tar.gz
curl -O https://example.com/file.tar.gz
# Check open ports
ss -tlnp # TCP listening ports
ufw status # firewall rules (if using UFW)
Service Management (systemd)
# Check service status
systemctl status nginx
systemctl status mysql
# Start / stop / restart
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx # reload config without downtime
# Enable/disable on boot
sudo systemctl enable nginx # start on boot
sudo systemctl disable nginx # don't start on boot
# View service logs
journalctl -u nginx --since "1 hour ago"
journalctl -u mysql -f # follow logs in real time
Package Management (Ubuntu/Debian)
# Update package lists
sudo apt update
# Upgrade installed packages
sudo apt upgrade -y
# Install a package
sudo apt install htop
# Remove a package
sudo apt remove htop
sudo apt autoremove # clean up unused dependencies
# Search for packages
apt search package-name
Compression & Archives
# Create a tar.gz archive
tar -czf backup.tar.gz /var/www/html/
# Extract a tar.gz archive
tar -xzf backup.tar.gz
# Create a zip
zip -r backup.zip /var/www/html/
# Extract a zip
unzip backup.zip
# List contents without extracting
tar -tzf backup.tar.gz
Cron Jobs (Scheduled Tasks)
# Edit your crontab
crontab -e
# Cron format: minute hour day month weekday command
# Examples:
# Run every 5 minutes
*/5 * * * * /path/to/script.sh
# Run daily at 3:00 AM
0 3 * * * /usr/bin/certbot renew
# Run every Sunday at midnight
0 0 * * 0 /root/backup.sh
# List current cron jobs
crontab -l
Handy One-Liners
# Check who's hitting your web server the most
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
# Find and kill a process by name
pkill -f "process-name"
# Watch a command output refresh every 2 seconds
watch -n 2 'df -h'
# Quick backup with timestamp
cp file.txt file.txt.$(date +%Y%m%d-%H%M%S)
Related Articles
Last updated 19 Apr 2026, 23:46 +0300.
Was this page helpful?