Terminal & Shell Basics

Understand terminals, shells, command execution, and how Linux processes commands internally.

Learn how to interact with Linux through the terminal and understand what actually happens when you execute commands.


Difficulty: Beginner
Estimated reading time: 25 min


What Is a Terminal?

When people start learning Linux, they often hear terms like:

  • terminal
  • shell
  • console
  • command line

and use them interchangeably.

But they are not the same thing.

The terminal is simply an interface that allows you to interact with the operating system through text commands.

Think of it as a window that gives you direct access to the system.

Popular terminal applications include:

Terminal Platform
GNOME Terminal Linux
Konsole KDE Linux
Windows Terminal Windows
iTerm2 macOS

The terminal itself does not execute commands.

That job belongs to something else:

The shell.


What Is a Shell?

The shell is a program that reads and executes commands.

It acts as a bridge between:

  • you
  • the operating system

When you type:

ls

the shell:

  1. reads the command
  2. finds the executable
  3. starts a new process
  4. displays the output

The shell is basically a command interpreter.


Terminal vs Shell

This distinction is extremely important.

A terminal is the application window.

A shell is the program running inside that window.

Simplified:

Terminal
Shell
Linux Kernel
Hardware

You can even run different shells inside the same terminal.


There are many shells available in Linux.

The most common ones are:

Shell Description
Bash Default on many Linux systems
Zsh More modern and customizable
Fish Beginner-friendly shell
sh Traditional Unix shell

Most Linux tutorials use Bash.

That is why learning Bash basics is extremely valuable.


Your First Commands

Let us start with a few basic commands.


whoami

Displays the currently logged in user.

whoami

Example output:

john

This command is useful because Linux is a multi-user operating system.

Permissions and access depend on the active user.


pwd

Displays the current working directory.

pwd

Example:

/home/john/projects

A lot of beginners think pwd means:

“Where am I?”

Technically, it shows:

The absolute path of the shell’s current working directory.

That detail matters later when working with scripts and processes.


ls

Lists files and directories.

ls

Example:

documents
downloads
notes.txt

Useful variants:

ls -l
ls -a
ls -la
Option Meaning
-l Long format
-a Show hidden files
-la Combine both

clear

Clears the terminal screen.

clear

This does not delete history.

It only clears visible output.


Understanding Command Structure

Most Linux commands follow a common structure:

command [options] [arguments]

Example:

ls -la /home

Breakdown:

Part Meaning
ls Command
-la Options
/home Argument

What Are Options?

Options modify command behavior.

Example:

ls

shows basic output.

But:

ls -la

shows:

  • hidden files
  • detailed information

Options are sometimes called:

  • flags
  • switches
  • parameters

Understanding Hidden Files

In Linux, files beginning with . are hidden.

Example:

.bashrc
.gitignore
.env

These files are commonly used for:

  • configuration
  • environment variables
  • system settings

To display hidden files:

ls -a

Getting Help

One of the best Linux skills is learning how to read documentation.


man

Displays the manual page for a command.

man ls

Manual pages often contain:

  • explanations
  • options
  • examples
  • advanced usage

You can quit using:

q

–help

Most commands also support:

ls --help

This provides a shorter help overview.


How Linux Executes Commands

This is where Linux becomes really interesting.

When you type:

ls

the shell does not magically know where ls exists.

It searches predefined directories stored inside an environment variable called:

PATH

Example PATH:

/usr/local/bin:/usr/bin:/bin

The shell searches these directories until it finds the executable.


Simplified Command Execution Flow

You type command
Shell reads input
Shell searches PATH
Executable is found
Kernel starts process
Output is returned

This entire process usually happens in milliseconds.


What Is an Executable?

An executable is a program that can be run by the operating system.

Examples:

/bin/ls
/bin/cat
/usr/bin/docker

You can locate executables using:

which ls

Example output:

/bin/ls

Everything Becomes a Process

When you execute a command, Linux creates a process.

A process is simply:

A running instance of a program.

Examples:

Program Process
bash Running shell
nginx Web server process
docker Docker daemon
python Python interpreter

Linux constantly manages thousands of processes simultaneously.


Understanding the Prompt

A terminal prompt often looks like this:

john@server:~$

Breakdown:

Part Meaning
john Current user
server Hostname
~ Current directory
$ Regular user

If you see:

#

instead of $, you are usually operating as the root user.


The Root User

Linux has a special administrative user called:

root

The root user has unrestricted access to the entire system.

That means root can:

  • install software
  • modify system files
  • manage users
  • stop services
  • delete critical files

This power is dangerous.

That is why Linux systems usually operate with regular users and temporary privilege escalation through:

sudo

Example:

sudo apt update

Why the Terminal Matters

At first the terminal may feel intimidating.

Especially if you come from Windows or macOS GUI workflows.

But the terminal gives you:

  • speed
  • automation
  • reproducibility
  • remote management
  • deep system control

Many tasks that require dozens of clicks in graphical interfaces can be done with a single command.


The Real Linux Skill

Learning Linux is not about memorizing commands.

It is about understanding:

  • how commands interact
  • how processes work
  • how the operating system behaves
  • how tools connect together

The terminal is simply your interface into that world.


What Comes Next

In the next chapter, we will explore the Linux filesystem hierarchy and understand:

  • how Linux organizes files
  • where applications store data
  • where logs live
  • how configuration files work
  • why Linux filesystem structure differs from Windows