# Terminal basics for your first VPS
Source: https://vpsdime.com/knowledgebase/getting-started/terminal-basics
Last reviewed: 2026-07-02
Summary: Enough command line to operate a server confidently, moving around, tab completion (the one habit that changes everything), reading and editing files with less and nano, driving services with systemctl, reading logs with journalctl and tail, sudo vs root, escaping vim, and the safety habits that prevent self-inflicted outages.

## What this is

Enough shell to run your server, not a Linux course. Every guide in this knowledge base hands you commands; this page is what makes them feel routine instead of risky. Twenty minutes here pays for itself the first week.

## Orientation

You're [connected](https://vpsdime.com/knowledgebase/getting-started/connecting-to-your-vps) and staring at a prompt like `root@myserver:~#`, that's *who* you are, *which machine*, and *where* (`~` is your home directory; `#` means root, `$` means a normal user).

- `pwd` prints where you are; `ls` lists what's here (`ls -la` shows everything, with permissions and owners, output you'll learn to read in the [403 guide](https://vpsdime.com/knowledgebase/troubleshooting/403-forbidden)).
- `cd /var/www` moves; `cd ..` goes up one; plain `cd` goes home.
- **Tab completion is the single habit to build first**: type a few characters of any command, path, or filename and hit **Tab**, the shell finishes it or shows the options. It's faster than typing *and* it can't typo a path. If Tab won't complete it, the thing probably doesn't exist, which is diagnostic gold.
- **Up-arrow** replays previous commands (edit and re-run); `Ctrl+R` searches your history; `Ctrl+C` cancels the current command; `Ctrl+L` clears the screen.

## Reading and editing files

- `cat file` prints a short file; `less file` pages through a long one (arrows/PageDown to move, `/word` to search, **`q` to quit**, the keystroke every beginner needs told once).
- `nano file` edits: type normally, **Ctrl+O** then Enter saves, **Ctrl+X** exits. The shortcut legend is right there at the bottom of the screen. Every edit-this-config instruction in this KB assumes nano.
- Land in **vim** by accident (some systems default to it)? Press `Esc`, type `:q!`, Enter, you're out, nothing saved. Now you know the joke.

## Driving services

The single most useful command family on a server, systemd runs everything:

```
systemctl status nginx      # is it running, and its last log lines
systemctl restart nginx     # stop + start
systemctl enable nginx      # start at boot (started ≠ enabled!)
```

That third distinction has [its own cautionary tale](https://vpsdime.com/knowledgebase/troubleshooting/services-not-starting-after-reboot). And when a service won't start, its own words are in the journal:

```
journalctl -u nginx -n 50    # last 50 log lines for that service
```

## Reading logs

- `tail -20 /var/log/nginx/error.log` shows the end of a log; `tail -f` **follows** it live, start it, reproduce your problem in another window, and watch the error appear in real time.
- `grep something file` finds lines containing it; `grep -r something /etc/nginx/` searches a whole directory. Half of troubleshooting is these two commands pointed at the right file.

## Power: sudo vs root

Day-to-day, work as [your normal user](https://vpsdime.com/knowledgebase/getting-started/first-30-minutes) and prefix commands that need power with `sudo`. The prompt asking for *your* password (not root's) is normal. Full root shells are for when you genuinely need them, mistakes as root have no seatbelt.

## Safety habits (learned here, not the hard way)

- **`rm` has no undo and no trash.** Before any `rm` with a wildcard, run the same pattern with `ls` first and look at what matched, [recovery after the fact is grim](https://vpsdime.com/knowledgebase/troubleshooting/recover-deleted-files).
- **Never `chmod 777`** to "fix permissions", [here's what to do instead](https://vpsdime.com/knowledgebase/troubleshooting/403-forbidden).
- **Editing SSH or firewall config? Keep your current session open** and test from a second terminal, the [lockout guide](https://vpsdime.com/knowledgebase/troubleshooting/restore-ssh-access) exists because people don't.
- **Copy exact error messages**, into a search engine, into [an AI chatbot](https://vpsdime.com/knowledgebase/support-coverage/software-and-server-management) (genuinely excellent at exactly this), or into a ticket. "It says permission denied for /var/www/html/index.php" is solvable; "it doesn't work" is not.
- `man command` or `command --help` when you wonder what a flag does, reading two lines of manual beats pasting mystery commands.

## Still need help?

You can [open a support ticket](https://vpsdime.com/open-ticket/). So we can help on the first reply, it's worth mentioning:

- the VPS hostname or IP,
- the command you ran and its exact output.

## Related questions

- "What basic commands do I need to manage a VPS?"
- "How do I edit a file on my VPS?"
- "How do I quit less or vim?"
- "How do I check if a service is running and see its logs?"
- "What's the difference between sudo and root?"
- "How do I safely delete files in the terminal?"
