Introduction to Linux and the Command Line
Learn what Linux is, why it runs most of the world’s servers, what a shell and terminal are, and run your first commands.
On this page 11 sections
Introduction
Most websites, cloud services, Android phones and supercomputers run on Linux. When developers deploy an app, connect to a server or build a Docker container, they are almost always working at a Linux command line. Learning it is one of the most useful skills in tech: it makes you faster on your own computer and is essential for backend, DevOps, cloud and security work.
- What Linux and Linux distributions are.
- The difference between a terminal, a shell and the command line.
- How to run your first commands and read their output.
- How commands, options and arguments fit together.
What Is Linux?
Linux is a free, open-source operating system kernel — the core program that manages a computer’s processor, memory, disks and devices. Linus Torvalds released the first version in 1991 as a student project, and thousands of developers and companies have contributed to it since. Combined with tools from the GNU project and others, it forms complete operating systems used everywhere:
Servers and the cloud
The large majority of web servers and cloud virtual machines run Linux, including the servers behind most websites you visit.
Containers
Docker containers are built on Linux features, and nearly all container images are based on a Linux distribution.
Phones and devices
Android is built on the Linux kernel, as are smart TVs, routers, cars and countless other embedded devices.
Supercomputers
Every one of the world’s 500 fastest supercomputers runs Linux.
Distributions
A distribution (or “distro”) packages the Linux kernel together with tools, a package manager and often a desktop. They share the same core commands, so what you learn here works almost everywhere:
| Distribution | Known for |
|---|---|
| Ubuntu | The most popular choice for beginners, cloud servers and WSL on Windows. Used throughout this course. |
| Debian | Stable and conservative; Ubuntu is based on it. |
| Fedora | Up-to-date software; sponsored by Red Hat. |
| Red Hat Enterprise Linux, Rocky, AlmaLinux | Enterprise servers with long-term support. |
| Alpine | Tiny — very common as a base for Docker images. |
| Arch | Build-it-yourself; popular with enthusiasts. |
Terminal, Shell and Command Line
These words are often used interchangeably, but they mean different things:
- The terminal is the window you type into — an app such as Windows Terminal, GNOME Terminal or macOS Terminal.
- The shell is the program inside it that reads your commands and runs them. The most common one on Linux is Bash; macOS uses Zsh, which is very similar.
- The command line is the text interface as a whole: you type a command, press Enter, and read the result.
Before each command, the shell shows a prompt, usually in the form user@computer:folder$. For example, priya@laptop:~$ means the user priya on a computer named laptop, in her home folder (~). The $ means a normal user; a # means you are the all-powerful root user. In this course, commands are shown without the prompt so you can copy them directly.
Your First Commands
Open a terminal (the next lesson shows how on any computer) and try these. whoami prints your username:
whoamiClick Run to see what this code prints.
hostname prints the computer’s name, and pwd (print working directory) shows which folder you are in:
hostnamepwdClick Run to see what this code prints.
echo prints whatever you give it — handy for testing and, later, for scripts:
echo "Hello, Linux!"Click Run to see what this code prints.
And this shows which Linux you are running. Every distribution describes itself in the file /etc/os-release:
cat /etc/os-release | head -4Click Run to see what this code prints.
Your terminal shows the prompt arjun@webserver:/var/www$. What does it tell you?
Anatomy of a Command
Most commands follow the same pattern: the command name, then options that change its behaviour, then arguments that say what to act on:
| Part | Example in ls -l /home | Meaning |
|---|---|---|
| Command | ls | The program to run — here, “list files” |
| Option (flag) | -l | Changes how it works — here, “long format”. Long options look like --help |
| Argument | /home | What to work on — here, the /home folder |
Nearly every command explains itself with --help, and man <command> opens its full manual (press q to quit):
ls --help | head -5Click Run to see what this code prints.
Put the steps of running a command in the order they happen.
- The shell shows a prompt and waits
- The shell finds the program and runs it
- The shell splits it into the command, options and arguments
- The output appears, followed by a new prompt
- You type a command and press Enter
When Something Goes Wrong
Linux is case-sensitive and literal. A typo produces an error rather than a guess:
ehco "oops"Click Run to see what this code prints.
Read error messages carefully — they nearly always say exactly what went wrong. (On Ubuntu desktops you may also see a suggestion such as “did you mean: echo”.) Two keyboard shortcuts will save you constantly: the Up arrow brings back previous commands, and Tab completes command and file names for you.
| Shortcut | What it does |
|---|---|
| Tab | Complete a command or file name (press twice to see options) |
| Up / Down arrows | Scroll through your previous commands |
| Ctrl+C | Stop the command that is running |
| Ctrl+L | Clear the screen (same as the clear command) |
| Ctrl+R | Search your command history |
Common Mistakes
- Typing Documents when the folder is called documents — Linux treats them as different names.
- Copying a command from the internet without understanding it, especially ones that start with sudo.
- Typing the $ from a tutorial’s prompt as part of the command.
- Ignoring the error message and trying random fixes instead of reading what it says.
Frequently Asked Questions
No. Windows users can use WSL, macOS has a very similar Unix terminal built in, and you can also use a free cloud server or a Docker container. Lesson 2 covers all of these.
Very much. Servers usually have no graphical interface, automation and scripts are written as commands, and many tasks are simply faster to type than to click.
Yes. The kernel and most distributions, including Ubuntu, Debian and Fedora, are free to download and use. Some companies pay for enterprise distributions mainly for support.
Key Takeaways
- Linux is a free, open-source operating system kernel that runs most servers, clouds and containers.
- Distributions such as Ubuntu package Linux with tools; the core commands work across them.
- The terminal is the window, the shell (usually Bash) runs your commands.
- Commands follow the pattern: command, options, arguments. Use --help and man to learn more.
- Linux is case-sensitive; read error messages and use Tab completion and command history.
Summary
You know what Linux is, what the shell does and how commands are built, and you have run your first ones. Next, you will get a Linux terminal running on your own computer — whether it uses Windows, macOS or Linux.