SSH gives you a terminal on a remote Linux server. This cheat sheet covers common tasks on an Ubuntu or Debian VPS, including files, services, resource checks and logs. Some managed plans also provide a control panel; shell access depends on your plan and account permissions.
Start with commands that inspect the system before making changes. The examples below assume a Bash-compatible shell and, for service management, a system using systemd. Replace sample paths, usernames and service names with those from your server.
Commands that edit files, stop services or remove data can affect a live site. Work from a current backup, check the target and use sudo only where your account is authorized to do so.
Key Takeaways
- Check files, service state, logs and resources before changing configuration.
- Use sudo only for authorized administrative operations.
- APT examples apply to Ubuntu and Debian; service names and paths can vary.
- Back up files before editing, and verify the target before deleting or stopping anything.
- Use manual pages to confirm options for the version installed on your VPS.
Connecting to Your VPS via SSH
SSH is a remote access command line management tool with security protocols you can depend on. It creates a secure connection through encryption that allows you to run commands, manage files, and configure services on a server.
Connecting to a server can typically be done with a command like
ssh username@server-ipOn the first connection, compare the host-key fingerprint with a trusted value from your provider or server administrator before accepting it. Authenticate using your password or SSH key; never share the private key.
Windows users can use OpenSSH in PowerShell, while macOS and Linux users can use a terminal. The SSH connection command is the same for different server regions, but installed utilities and service names depend on the operating system.
When working with a VPS, most of your tasks require navigating files and directories. These commands are critical for efficient management.
pwd – Prints the current working directory.
Example:
pwdTypical VPS use case: Confirm your current location before editing files or running commands.
ls – Lists files and directories.
Example:
ls /var/www/htmlTypical VPS use case: Review website files inside your web root directory.
cd – Changes the current working directory.
Example:
cd /etc/nginxTypical VPS use case: Navigate to configuration directories before making changes.
mkdir – Creates a new directory.
Example:
mkdir backupsTypical VPS use case: Create folders for backups, logs, or new projects.
rm removes files; directories require additional options. Check every target before deletion.
Example:
rm -i -- old-backup.zipTypical VPS use case: Remove a verified unneeded file. The -i option asks for confirmation; rm does not move a file to a desktop Trash folder. Keep a backup if you may need it again.
cp – Copies files or directories.
Example:
cp -i -- nginx.conf nginx.conf.bakTypical VPS use case: Copy a configuration file before editing it. The -i option prompts before overwriting an existing destination; use a distinct backup name for each change.
mv – Moves or renames files and directories.
Example:
mv app.conf app.conf.oldTypical VPS use case: Rename configuration files or move website files during deployments.
touch – Creates an empty file or updates a file’s timestamp.
Example:
touch index.htmlTypical VPS use case: Create new configuration, log, or placeholder files.
Before modifying a configuration file, make a separate backup and check ownership and permissions. File commands work in your current directory unless you supply an absolute path.
Managing Logs and Configuration Files
When assessing the performance of your web application on a VPS, you will be inspecting logs and editing configuration files. The following commands will help you edit and view files via the terminal.
cat – Displays the entire contents of a file.
Example:
cat /etc/nginx/nginx.confTypical VPS use case: Quickly view a configuration file or small log file.
less – Opens a file in an interactive viewer, allowing you to scroll forward and backward.
Example:
sudo less /var/log/nginx/error.logTypical VPS use case: Read large log files without loading the entire file into the terminal.
head – Displays the first lines of a file (10 by default).
Example:
sudo head /var/log/syslogTypical VPS use case: Check the beginning of a log or configuration file.
tail – Displays the last lines of a file (10 by default) and can monitor updates in real time with the -f option.
Example:
sudo tail -f /var/log/nginx/error.logTypical VPS use case: Monitor server logs live while troubleshooting website or application errors.
nano – A beginner-friendly terminal text editor for creating and editing files.
Example:
sudo nano /etc/nginx/nginx.confTypical VPS use case: Edit Nginx, Apache, or SSH configuration files directly on the server.
vim – A powerful terminal text editor with advanced editing features.
Example:
sudo vim /etc/ssh/sshd_configTypical VPS use case: Edit a configuration file if you already know vim. Press Escape and type :q! to quit without saving, or :wq to save and quit.
Protected files and logs may require sudo. Press q to leave less, top or the systemctl status pager, and Ctrl+C to stop tail -f. In nano, use Ctrl+O to write, Enter to confirm the name, and Ctrl+X to exit. Back up a configuration file before editing it and validate the service configuration before reloading it.
User and Permission Management Commands
The security of your VPS relies on a large part of permissions and user management. With these commands, you can control access to your server.
sudo– allows execution of commands with root privilegeschmod– alter permissions for files and folderschown– change ownership of a filepasswd– change a user’s passworduseradd, usermod– create and alter user accounts
Check the intended owner, group and service account before changing permissions. Broad changes can break an application or expose files. Apply the narrowest access that supports the required task.
Service Management Commands
Most applications on a VPS run as services. The stability of your VPS relies on your ability to manage these services. The primary command used for controlling these services is systemctl.systemctl status– shows the current state of the servicesystemctl start/stop/restart– alter the state of the servicesystemctl enable nginx— configure Nginx to start at boot; it does not start it now.
Use systemctl status nginx and relevant logs to investigate a failed web server before restarting it. Start, stop and restart change service state and can interrupt traffic. Unit names vary: Ubuntu commonly uses apache2, while another distribution may use httpd. systemctl enable configures startup behavior; it does not start the service immediately.
“Note that this does not have the effect of also starting any of the units being enabled.”
Server Resource Monitoring Commands
Keeping resources within the limits of your VPS hosting helps you understand the behavior of your system and helps you maintain your VPS’s performance and stability. Here are some commands combined with their brief descriptions:
top, htop– list processes and provide CPU and RAM usage (in real time)free– provides RAM usage statisticsdf– provides statistics for disk storage usagedu– gives the size of files and directories on disk and helps locate spacious directoriesuptimeshows how long the system has been running and its load averages. Load average is not a CPU-use percentage.
Process Management Commands
Inspect a process before sending it a signal. A high CPU reading does not, by itself, prove that a process should be terminated.
ps– lists the processes running on the systemkill PIDsends SIGTERM by default, allowing a process to shut down. Check the PID first.killallcan affect every process matching a name; avoid broad matches.pgrep -a nginxlists matching process IDs and command lines for inspection.
Networking Commands for VPS Administration
Understanding networking commands for your VPS will give you insight into the way your VPS connects to the internet and external services and systems. It is also useful for diagnosing connectivity and verifying that everything is functioning normally.
ip– displays information about network interfaces and IP addresses, along with the routing infopingtests ICMP reachability. A failed ping may mean ICMP is blocked; it does not prove that a website is down.traceroute– shows the route that data takes to a particular destinationssdisplays sockets and listening services;netstatis an older alternative that may not be installed.curl, wget– can make API calls, test endpoints, and even download files from the web
Log Analysis Commands
Logs record events that help you investigate a server problem. Match messages to the failing request and its timestamp, then check the relevant service configuration.
tail -f– allows you to see the log file as it updates in real timegrep– allows you to search for specific patterns or even specific errors in log filesjournalctl– allows you to see the logs for services in the OS and logs of the operating system itself
Package Management Commands
Use APT for package management on Ubuntu and Debian. Other distributions use different tools. Administrative operations normally require sudo. apt update refreshes the index; it does not install upgrades. Review changes before running an upgrade and plan any required restart or reboot.apt update– refreshes package listsapt upgrade– updates already installed packagesapt install– adds packagesapt remove– takes packages away
Linux Commands for Security
Security is one of the most important things to consider when managing Virtual Private Servers. Linux provides VPS managers with plenty of ways to help defend against intruders and attacks.
These utilities support a security configuration; their presence alone does not secure a server:
ufwmanages host firewall rules. Allow the actual SSH port before enabling or changing remote-access rules.fail2ban-clientqueries and controls the Fail2Ban service. Protection depends on correctly configured jails, filters and log sources.ssh-keygencreates an SSH key pair. Protect the private key with a passphrase and install only the public key on the server.
Docker Commands VPS Owners Should Know
Docker runs applications in containers. These commands apply only when Docker is installed and your account is authorized to use it.
Some basic commands include:
docker ps: lists all the running containers.docker logs: shows logs for debugging.docker stop: stops running containers.docker restart: restarts containers/services.
Docker access can carry root-level privileges, including membership of the docker group. Do not grant it casually. Stopping or restarting a container interrupts its workload; inspect logs first. Review published ports separately because Docker networking can bypass UFW rules.
Linux Commands Cheat Sheet Table
Use these examples as a reference, not as a sequence to run. Replace sample usernames, paths, owner:group and PID with verified values from your server. Commands that change files or processes require the same checks described above:
| Command | Purpose | Common Use Example |
|---|---|---|
ssh | Connect to a remote server securely | ssh username@server-ip |
| df | Disk usage | df -h |
ls | List files and directories | ls /var/www/html |
pwd | Show current directory | pwd |
cd | Change directory | cd /etc/nginx |
| grep | Search text | grep -n 'error' app.log |
mkdir | Create a new directory | mkdir backups |
rm | Remove files or directories | rm -i -- unused-file.txt |
nano | Edit files in the terminal | nano notes.txt |
tail | View the end of a file | tail -n 50 app.log |
chmod | Change file permissions | chmod 640 private-notes.txt |
chown | Change file ownership | sudo chown owner:group file |
systemctl | Manage system services | systemctl status nginx |
top | Monitor system resources | top |
free | Display memory usage | free -m |
ps | List running processes | ps aux |
kill | Send a termination signal to a verified process | kill -TERM PID |
ping | Test network connectivity | ping -c 4 example.com |
curl | Send HTTP requests | curl -I https://example.com |
apt update | Refresh package lists | sudo apt update |
ufw | Manage firewall rules | sudo ufw status verbose |
docker ps | List running Docker containers | docker ps |
Common VPS System Commands
Management of VPS systems is generally accomplished using a number of Linux system commands. Below are examples of tasks commonly done and the commands used to accomplish them.
- Check available RAM:
free -m - Inspect Nginx:
systemctl status nginx - Follow the Nginx error log:
sudo tail -f /var/log/nginx/error.log - List listening TCP and UDP sockets:
sudo ss -tulpn - Check filesystem space:
df -h - Review recent Nginx logs:
sudo journalctl -u nginx --since "1 hour ago"
With these commands, system administrators are capable of monitoring the performance of their system, troubleshooting errors, and managing software applications.
Why Linux VPS Hosting is Popular
A Linux VPS can suit projects that need custom packages, services or network settings. That flexibility comes with responsibility for maintaining the operating system and application.
A VPS gives you a virtual environment with the resources defined by your plan. It is not automatically faster than shared hosting: performance depends on resources, contention, application configuration and workload.
Why UltaHost Linux VPS Is Ideal for Server Management
An UltaHost Linux VPS with root access lets you administer the installed operating system and services. Confirm which management, backup and support tasks are included in the plan you choose.
Most examples here use standard Linux tools. Install optional utilities only when needed, and use the documentation for your distribution and installed version. A command written for Ubuntu is not necessarily correct for every Linux image.
Conclusion: VPS Management and Mastering Commands
Use a small set of inspection commands to establish what is wrong, then make one controlled change at a time. Check the result and preserve useful logs before restarting services or removing files.
Keep this cheat sheet alongside the manual pages available through man command-name or command-name --help. Check the installed version’s options before copying a command into a production server.
FAQ
What are the most important Linux commands for VPS management?
The most important commands include ls, cd, systemctl, top, df, grep, and ssh, as they cover file management, services, monitoring, and troubleshooting.
Do I need to know Linux to manage a VPS?
Basic shell knowledge helps when you administer Linux over SSH. Some managed services provide a control panel; the access and tasks available depend on your plan.
How do I check if my VPS is running properly?
You can use commands like uptime, top, systemctl status, and free -m to check system health, resource usage, and active services.
What command is used to restart a VPS service?
On a systemd server, sudo systemctl restart service-name restarts the named service. Inspect its status and logs first, confirm the unit name, and expect a possible interruption.
How do I find errors on my VPS?
You can use tail -f, grep, and journalctl to view and search log files, which helps in identifying server errors quickly.