Terminal basics for your first VPS
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 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).
pwdprints where you are;lslists what's here (ls -lashows everything, with permissions and owners, output you'll learn to read in the 403 guide).cd /var/wwwmoves;cd ..goes up one; plaincdgoes 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+Rsearches your history;Ctrl+Ccancels the current command;Ctrl+Lclears the screen.
Reading and editing files
cat fileprints a short file;less filepages through a long one (arrows/PageDown to move,/wordto search,qto quit, the keystroke every beginner needs told once).nano fileedits: 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. 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.logshows the end of a log;tail -ffollows it live, start it, reproduce your problem in another window, and watch the error appear in real time.grep something filefinds 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 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)
rmhas no undo and no trash. Before anyrmwith a wildcard, run the same pattern withlsfirst and look at what matched, recovery after the fact is grim.- Never
chmod 777to "fix permissions", here's what to do instead. - Editing SSH or firewall config? Keep your current session open and test from a second terminal, the lockout guide exists because people don't.
- Copy exact error messages, into a search engine, into an AI chatbot (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 commandorcommand --helpwhen you wonder what a flag does, reading two lines of manual beats pasting mystery commands.
Still need help?
You can open a support 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?"