The shell and your first commands
pwd, ls, cd, and the difference between the terminal, the shell, and a command. · 9 min
A terminal (or terminal emulator) is the program that gives you a text window and handles keyboard input and screen output. A shell is the program running inside that terminal that reads what you type, interprets it, and runs commands — bash is the default shell on the overwhelming majority of Linux distributions, though zsh and others exist. When you SSH into a server, you are connecting directly to a shell session — there is no terminal emulator involved on the remote end in the GUI sense, just a shell reading from and writing to your SSH connection.
Three commands answer the three questions you ask constantly when working blind on a remote server: `pwd` (print working directory) tells you where you are, `ls` lists what's in the current directory, and `cd` changes into another directory. These sound trivial, but on an unfamiliar server with no GUI, "where am I and what's here" is the very first thing you establish before doing anything else — treat it as a habit, not a formality.
A few commands round out basic orientation: `whoami` and `id` tell you who you're logged in as and what groups you belong to (critical before you assume you have permission to do something), `hostname` tells you which machine you're actually on (easy to forget when you have six SSH sessions open in different tabs), and `history` shows your recent command history — genuinely useful for reconstructing "what did I just run that broke this".
| Command | Purpose | Example |
|---|---|---|
| pwd | Print the current working directory | — |
| ls | List directory contents | ls -la → long format, including hidden files |
| cd | Change directory | cd /var/log cd .. cd ~ cd - (previous directory) |
| whoami | Print the current username | — |
| id | Print user and group IDs for the current (or a named) user | — |
| hostname | Print the system's hostname | — |
| history | Show recent command history for the current shell session | — |
| clear | Clear the terminal screen (doesn't affect history or running processes) | — |
A typical orientation sequence on an unfamiliar server
$ whoami
deploy
$ hostname
web-prod-03
$ pwd
/home/deploy
$ ls -la
total 24
drwxr-xr-x 3 deploy deploy 4096 Sep 19 10:02 .
drwxr-xr-x 5 root root 4096 Aug 2 09:11 ..
-rw-r--r-- 1 deploy deploy 220 Aug 2 09:11 .bash_logoutTakeaway: Before doing anything on an unfamiliar server, run whoami, hostname, and pwd — cheap habits that prevent a surprising number of "wrong machine" or "wrong permissions" mistakes.