The first commands on your VPS: finding your way around the command line
You've logged in to your VPS for the first time and all you see is a blinking cursor. A handful of commands will help you find your way around: where you are, what's in a folder, how to read or edit a file and how your server is doing. Not logged in yet? First read Logging in to your VPS with SSH (and creating an SSH key) and, the first time, compare the fingerprint as described in Logging in with SSH for the first time.
Reading the prompt
To the left of the cursor is the prompt, for example anna@web1:~$. It tells you who you are (anna), which server you're on (web1) and which folder you're in (~ is your own home folder). The last character matters: $ means a regular user, # means root. Root can do anything, without asking "are you sure". So it's better to work with your own user and put sudo in front of commands that need admin rights. How to create that user is explained in Your own user with sudo.
Looking around in folders
| Command | What it does |
|---|---|
pwd | Shows which folder you're currently in |
ls -la | Shows the contents of the folder, with permissions, owner and size, including hidden files (names starting with a dot, such as .ssh) |
cd /etc/ssh | Goes to a folder. cd .. goes up one folder, cd with nothing after it takes you back to your home folder |
You'll run into a few folders all the time: /etc (configuration), /var/log (log files), /home (home folders), /root (root's home folder) and /var/www or /srv (websites and services). Capitals matter: /etc/SSH doesn't exist, /etc/ssh does.
Reading and editing files
cat bestandshows a short file all at once.less bestandlets you scroll with the arrow keys and the space bar. Search with/woord, quit withq.tail -n 50 bestandshows the last 50 lines, handy for log files.nano bestandopens a simple editor. Save with Ctrl+O and Enter, exit with Ctrl+X.
Make a copy before you edit a configuration file, for example sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak. Change one thing at a time, and test the configuration before restarting the service: many programs have their own command for that, such as sudo sshd -t or sudo nginx -t.
How is your server doing?
| Command | What you see |
|---|---|
cat /etc/os-release | Which operating system and version is running, for example Debian 13 or Ubuntu 24.04 LTS |
uptime | How long the server has been running and the load over 1, 5 and 15 minutes |
df -h | Free disk space. A full disk is a common reason a server stops "out of nowhere" |
free -h | Memory. Look at the available column, not at free: Linux uses free memory as cache and gives it back when a program needs it |
ip -brief address | Your server's IP addresses |
Is your disk filling up or is the server slow? Check Disk full, memory full or slow. Need more disk space? See Increasing your VPS disk space.
Finding help
man lsopens the manual for a command. Scrolling and searching work just like inless. If the manuals are missing, install them withsudo apt install man-db.ls --helpgives a short list of options for most commands.- The Tab key completes command and file names. That saves you typos. Press the up arrow to bring back earlier commands.
rm has no recycle bin: once it's gone, it's gone. Be extra careful with rm -r (a folder with everything in it) and with wildcards such as *, especially when you're root. Also, don't paste commands from the internet without reading them first. Make a snapshot before a big change, see Snapshots and backups of your VPS.Your VPS is fully self-managed: whatever happens inside your server, you manage yourself. We help with the WebOké side, such as the VPS screen, the network and snapshots. Prefer working with a hosting package? There you get a more limited command line, see SSH access and the Terminal in DirectAdmin: which packages and how to log in.
Want to learn more? Take the free course VPS and Linux server management, lesson 1.4 Looking around on the command line.
