Understanding Shell, Terminal, and Console

Shell, terminal, and console are three words that beginners use interchangeably and experts use precisely. They refer to three different layers of the command-line experience. Understanding the difference matters because when something breaks — an SSH session drops, a terminal emulator hangs, or a shell variable is not set — knowing which layer the problem is in tells you where to look.

The three concepts

┌────────────────────────────────────────────────────────────────┐
│                        You (human)                             │
└───────────────────────────┬────────────────────────────────────┘
                            │ types commands, reads output
┌───────────────────────────▼────────────────────────────────────┐
│              Terminal (or Console)                             │
│   The interface that accepts input and displays output         │
│   Examples: GNOME Terminal, PuTTY, SSH session, /dev/tty1     │
└───────────────────────────┬────────────────────────────────────┘
                            │ sends keystrokes, receives text
┌───────────────────────────▼────────────────────────────────────┐
│                       Shell                                    │
│   The program that interprets commands and runs programs       │
│   Examples: bash, sh, zsh, dash                               │
└───────────────────────────┬────────────────────────────────────┘
                            │ creates processes, calls kernel
┌───────────────────────────▼────────────────────────────────────┐
│                    Linux Kernel                                │
│   The operating system core — manages hardware and processes   │
└────────────────────────────────────────────────────────────────┘

What is the console?

The console is the physical or virtual terminal directly attached to the machine. On a server with a monitor and keyboard, the console is what you see on the screen. On a VM, the console is what you see in the hypervisor’s display panel.

Linux provides virtual consoles — multiple independent text sessions you can switch between using Ctrl+Alt+F1 through F6:

# Switch to virtual console 2 (from the physical keyboard)
# Ctrl+Alt+F2

# Check which virtual console you are on
tty

Output

/dev/tty2

The console is your emergency access method. When SSH is broken, the firewall is locked, or the network is down, the console is how you recover the server. Cloud providers expose this as a Serial Console or Emergency Console in their web dashboard.

What is a terminal?

A terminal emulator is a program that emulates a physical terminal inside a GUI window or over a network connection. SSH is a terminal connection over the network — your SSH client (PuTTY, iTerm2, Windows Terminal) is the terminal emulator.

ContextTerminal being used
SSH session from WindowsPuTTY or Windows Terminal (SSH client)
SSH session from Linux/MacTerminal app + ssh client
Ubuntu Desktop, GUI terminalGNOME Terminal, Tilix, etc.
Server physical/VM consoleVirtual console (/dev/ttyN)
Serial console on cloudCloud provider’s serial console
# See information about your current terminal
echo $TERM              # Terminal type (xterm-256color, vt220, etc.)
tty                     # The device file for this terminal

# Check terminal dimensions
stty size               # Rows and columns (e.g., 24 80)

What is the shell?

The shell is the program that runs inside the terminal and interprets your commands. When you type ls -la and press Enter, the shell reads that text, finds the ls binary, passes it the -la argument, runs it as a child process, and displays the output.

# See which shell you are currently using
echo $SHELL             # Your default login shell
echo $0                 # The shell that is currently running

# List all available shells
cat /etc/shells

# Check the shell for a specific user
grep irfan /etc/passwd

Example output of grep irfan /etc/passwd

irfan:x:1000:1000:Irfan Aslam,,,:/home/irfan:/bin/bash
                                              ↑           ↑
                                          home dir    login shell

Bash: the default Ubuntu shell

Ubuntu uses Bash (Bourne Again Shell) as the default login shell for new users. Bash is the shell you are almost certainly using unless you have explicitly changed it. Its configuration files, scripting syntax, and history management are what this entire article series assumes.

ShellPackageDefault on Ubuntu?Notes
bashbashYes (login and interactive)Most compatible, recommended for scripts
sh (dash)dashYes (/bin/sh symlink)Minimal POSIX shell; used for system scripts (faster)
zshzshNoFeature-rich; popular with developers
fishfishNoUser-friendly; non-POSIX syntax
# Check bash version
bash --version

# Change your default shell to zsh (if installed)
chsh -s $(which zsh)

# You must log out and back in for the change to take effect
# Verify after re-login:
echo $SHELL

Shell configuration files

Bash reads configuration files at different points. Knowing which file to edit determines whether your change applies to login sessions, interactive sessions, or both.

FileWhen readUse for
/etc/profileLogin shell, all usersSystem-wide environment
/etc/profile.d/*.shLogin shell, all usersModular system additions (added by packages)
~/.bash_profileLogin shell, this userUser-specific login setup
~/.bashrcInteractive non-login shellAliases, functions, prompt customisation
~/.bash_logoutOn logoutCleanup tasks
# Edit your shell customisations
nano ~/.bashrc

# After editing .bashrc, reload it without logging out
source ~/.bashrc
# or:
. ~/.bashrc

# Add a custom alias (put this in ~/.bashrc)
alias ll='ls -lhta'
alias grep='grep --color=auto'

# Add a directory to PATH permanently (put this in ~/.bashrc)
export PATH="$PATH:/usr/local/myapp/bin"

Environment variables

Environment variables are key=value pairs that programs can read. They control many aspects of how commands behave.

# List all current environment variables
env

# Print a single variable
echo $HOME
echo $PATH
echo $USER

# Set a variable for the current session only (lost on logout)
MY_VAR="hello"
echo $MY_VAR

# Export a variable so child processes can read it
export DATABASE_URL="postgres://localhost/myapp"

# Common important variables:
echo $HOME      # Your home directory
echo $PATH      # Directories searched for commands
echo $USER      # Current username
echo $SHELL     # Your login shell
echo $EDITOR    # Default text editor (used by git, visudo, etc.)

💡 TIP: If a command works when you type it but not in a cron job or script, a missing PATH variable is usually the reason. Cron jobs run with a minimal environment that does not include your .bashrc. Always use absolute paths in cron jobs (/usr/bin/python3 not python3).

Conclusion

The console is the physical or out-of-band access point. The terminal is the interface (SSH client, terminal emulator). The shell (bash) is the interpreter that actually runs your commands. When SSH breaks and you cannot connect, the console saves you. When a command works interactively but not in a script, the missing environment is usually the cause.

FAQ

Why should administrators understand Understanding Shell, Terminal, and Console?+

Because this topic affects planning decisions, server lifecycle, compatibility, support expectations, or how you reason about Ubuntu systems before making operational changes.

Do I need a lab for this topic?+

A lab is useful for checking commands and seeing the concept on a real Ubuntu machine, but the main value is understanding the decision, tradeoff, or system behavior clearly.

How should I use this knowledge in production?+

Use it to make better choices, document why those choices were made, and avoid rushed changes that ignore support windows, compatibility, stability, or operational risk.

Need help with Ubuntu administration?

Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.

Hire Me for Support