Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A virtual private server (VPS) is usually managed remotely through an encrypted SSH session. Before changing anything, establish who you are, which machine you reached, where you are in its filesystem, and whether you have administrative privileges. This primer builds the command vocabulary and safety habits needed to update software, inspect services, diagnose outages, and avoid locking yourself out.

Start every SSH session by establishing context

OpenSSH supplies the encrypted client and server tools used for remote administration, replacing older clear-text tools such as telnet and rcp. Connect with a user account and the server’s address:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh user@server-ip
# or, when you have an entry in ~/.ssh/config
ssh my-vps

Once connected, run these read-only checks:

whoami
hostname
pwd
uname -a
df -h
  • whoami shows the account executing commands.
  • hostname identifies the machine, which matters when several VPSs look alike.
  • pwd prints your current directory.
  • uname -a reports kernel and architecture details.
  • df -h shows filesystem capacity in human-readable units; a full root filesystem can make an otherwise healthy service fail.

Ubuntu installations normally disable direct administrative root login. Routine work should use a non-root account and elevate only the individual command that needs it with sudo.

Build a small, safe command vocabulary

Paths and navigation

An absolute path starts at /, such as /etc/ssh/sshd_config. A relative path starts from your current directory. $HOME (often written ~) is your home directory; /etc contains system configuration, /var/log commonly contains logs, and /tmp is temporary storage. A leading dot makes a file hidden, so ls alone will not show .ssh.

pwd
ls -la
cd /var/log
cd ..
cd "$HOME"
less syslog

ls -la includes hidden entries and long-format ownership and permission information. less lets you page through a file without loading it into an editor; press q to leave.

Create and copy files

mkdir -p ~/maintenance/notes
touch ~/maintenance/notes/change.txt
cp original.conf ~/maintenance/notes/original.conf.bak
mv old-name.log archive.log

Quote paths containing spaces or shell metacharacters: less "Quarterly report.txt". Wildcards are expanded by the shell before a command runs: *.log can match many files, while .* can include special entries such as . and .. in some contexts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Search text and files

grep -R "error" /var/log
find /var/log -type f -name "*.log"
command --help
man command
history

Use grep to search text recursively and find to locate files by type or name. man displays the installed manual page; press q to exit. history helps you reuse a known command, but inspect recalled commands before pressing Enter because an old wildcard or path may no longer be safe.

Destructive-command safety box

  • Run pwd and ls -la immediately before deleting or moving anything.
  • Quote paths with spaces and prefer an explicit path over a broad wildcard.
  • rm -r removes directories recursively; adding -f suppresses prompts. Do not use rm -rf until you can explain exactly which names the shell will expand.
  • Keep backups outside the directory you are about to alter, and write down the intended change.

Users, sudo, ownership and permissions

Identify your privileges

id
groups
sudo -l

id displays your user and group IDs, groups lists memberships, and sudo -l shows commands your account may elevate. Use sudo command for one administrative operation rather than working in a root shell all day; the resulting audit trail makes mistakes easier to attribute.

Read a permission string

ls -l /path/to/file
stat /path/to/file

A listing such as -rw-r----- 1 alice web 2048 ... identifies the owner (alice), group (web), and read/write/execute bits for owner, group and everyone else. Directories need execute permission to be traversed. Change only what the task requires:

chmod 640 settings.conf
chown alice:web settings.conf
chgrp web settings.conf

chmod 777 is not a universal repair: it grants every local user read, write and execute access and can expose credentials or executable files. For SSH keys, ensure only the account can write its key files:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
chmod go-w ~/.ssh/authorized_keys

Correct ownership and permissions on both ~/.ssh and authorized_keys if SSH rejects an otherwise valid key.

Confirm the Linux distribution before installing or updating

Images differ by distribution, repository configuration and installed shell. Inspect the operating system before copying package commands:

cat /etc/os-release
Distribution family Typical package tool Beginner guidance
Ubuntu or Debian apt Refresh metadata, then apply upgrades.
Fedora, RHEL and related images dnf Use the distribution’s documentation and repository policy.

For Ubuntu or Debian, the normal sequence is:

sudo apt update
sudo apt upgrade

apt update downloads current package indexes; apt upgrade changes installed software. A package update can require a service restart and can alter production behavior. Schedule changes, keep a provider console or recovery route available, and record what you changed. Never paste an Ubuntu command into an unidentified image.

Inspect processes, services and logs separately

A process is a running program instance. A service is a managed unit, commonly controlled by systemd. A log is a record of events; it is evidence, not a running component.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check resource pressure

ps aux
top
free -h
df -h
du -sh /var/*

ps aux gives a snapshot of processes. top continuously sorts activity; htop is a friendlier alternative when installed. free -h reports memory and swap, df -h reports filesystem space, and du -sh identifies directories consuming storage.

Rank #2
Linux Encryption Command Line T-Shirt, Men, Black, Small
  • Linux Encryption Tools design. Linux Encryption Command Line T-shirt. Linux funny T-shirt
  • Linux Funny T-shirt, Linux humor T-shirt, Linux jokes T-shirt
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

Inspect and restart a service

sudo systemctl status SERVICE
sudo systemctl is-enabled SERVICE
sudo systemctl restart SERVICE
sudo journalctl -u SERVICE -b --no-pager

Replace SERVICE with a unit such as nginx or ssh.service. Use status for the current state and recent messages, is-enabled to see whether it starts at boot, and journalctl for this boot’s complete unit log. Restart only after reading the status and checking configuration; a restart interrupts active connections even when it avoids the longer disruption of a reboot.

For live SSH troubleshooting on Ubuntu, these commands show validation output while you reproduce a problem:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl restart ssh.service
sudo journalctl -fu ssh.service

Diagnose networking from facts

Interfaces, routes and name resolution

ip addr
ip route
getent hosts example.com

ip addr shows assigned addresses, ip route shows where packets go, and getent hosts tests resolver behavior using the system’s configured sources. A working interface does not prove that DNS or the default route is correct.

Find listening ports and their owners

sudo ss -tulpn

The -t, -u, -l, -p and -n options show TCP, UDP, listening sockets, owning processes and numeric addresses. Identify the process bound to a port before changing firewall rules. Otherwise you may open an unnecessary port or hide a service that failed to start.

Host firewall versus cloud security group

Control Scope Typical failure mode
Host firewall Rules on the VPS operating system A local rule blocks traffic even when the provider allows it; a mistaken SSH rule can cut off your session.
Cloud-provider security group Filtering outside the guest, at the provider network edge The guest appears correctly configured but packets never reach it.

Keep the existing SSH path working until an alternate path has been tested. A service restart affects one managed unit; a full reboot interrupts every service and is mainly a recovery or kernel-change action, not a first diagnostic step.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Change SSH configuration without locking yourself out

  1. Open a second SSH session and leave the first one untouched.
  2. Back up the file or snippet before editing /etc/ssh/sshd_config.
  3. Edit only the required directive and preserve a known-good copy.
  4. Validate syntax without restarting: sudo sshd -t.
  5. If validation succeeds, restart: sudo systemctl restart ssh.service.
  6. Test a new login in the second session before closing the original.

An incorrect directive can stop sshd and remove your only remote route. Know the VPS provider’s web console or recovery environment before making changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use key authentication

ssh-keygen -t ed25519
ssh-copy-id user@server-ip

Create a key protected by a passphrase, copy the public key, and verify a new key-based login. Do not disable password authentication until that login works and console recovery is available. Protect the private key on your workstation; never paste it into authorized_keys.

Keep long-running work alive after SSH drops

A normal shell ends when its SSH connection disappears, which can terminate a build, migration or upgrade. Start the task in a terminal multiplexer:

tmux new -s maintenance
# or
screen

Detach without stopping the program, reconnect later, and reattach with tmux attach -t maintenance (or the corresponding screen -r command). Multiplexers preserve the process and its output after a network interruption, but they do not replace backups or a recovery plan.

A repeatable outage checklist

  1. Confirm identity and host with whoami and hostname.
  2. Check disk and memory using df -h, du and free -h.
  3. Check the affected service with systemctl status and read its journalctl entries.
  4. Inspect interfaces, routes, DNS and listening sockets with ip, getent and ss.
  5. Identify the process owning the expected port before touching firewall rules.
  6. Apply one reversible change, validate it, and record the result.
  7. Keep an open SSH session and provider console path until the system is confirmed healthy.

Further structured learning

William E. Shotts’s The Linux Command Line, 3rd Edition is listed at 544 pages with a 2026 publication date; the paperback listing gives February 17, 2026 and ISBN 9781718504523. The publisher describes it as beginner-to-intermediate coverage from first terminal keystrokes through Bash programming, and the author provides a free digital edition. Availability and price vary by region and retailer. The earlier second edition is listed at 504 pages with a March 7, 2019 publication date; the first edition’s publisher reported more than 100,000 copies sold in 2019, a figure that does not describe later editions.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 2
Linux Encryption Command Line T-Shirt, Men, Black, Small
Linux Encryption Command Line T-Shirt, Men, Black, Small
Linux Encryption Tools design. Linux Encryption Command Line T-shirt. Linux funny T-shirt; Linux Funny T-shirt, Linux humor T-shirt, Linux jokes T-shirt
$16.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.