Practical Unix
Lesson 1 of 250%
Lesson 1·15 min

Getting Started with the Terminal

What you'll learn

  • Understand what a shell is and why it matters
  • Open and navigate your terminal application
  • Run your first commands
  • Understand command structure and arguments

What Is a Shell?

A shell is a program that interprets your commands and communicates with the operating system. When you open a terminal, you're interacting with a shell.

The most common shells are:

  • Bash (Bourne Again Shell) - The default on most Linux systems
  • Zsh - The default on macOS (since Catalina)
  • Fish - A modern, user-friendly alternative

For this course, we'll focus on concepts that work across all shells.

Your First Commands

Let's start with the basics. Open your terminal and try these:

whoami

This displays your username. Simple, but it confirms your terminal is working.

date

Shows the current date and time. Notice how commands just... run? No clicking, no menus.

echo "Hello, Unix!"

The echo command prints text to the screen. We'll use this a lot for debugging and scripting.

Understanding Command Structure

Unix commands follow a consistent pattern:

command [options] [arguments]

Let's break this down:

  • command - The program you want to run (e.g., ls, cat, grep)
  • options - Modify how the command behaves (usually start with - or --)
  • arguments - What the command operates on (files, directories, text)

Example: The ls Command

ls

Lists files in the current directory.

ls -l

The -l option shows a "long" format with details like permissions, size, and dates.

ls -la /home

Here we combine options (-l and -a for "all", including hidden files) and provide an argument (/home directory).

Tip

Most commands have a `--help` option that shows available options. Try `ls --help` to see all the things `ls` can do!

The Manual Pages

Unix has built-in documentation called "man pages" (short for manual):

man ls

This opens the full documentation for ls. Use arrow keys to scroll, and press q to quit.

Note

Man pages can be overwhelming at first. Focus on the DESCRIPTION and EXAMPLES sections. The rest will make sense as you learn more.

Practice Exercise

Try these commands and observe the output:

  1. Run pwd - What does it show?
  2. Run ls -la in your home directory
  3. Run man echo and find out what the -n option does

Key Takeaways

  • The shell is your interface to the operating system
  • Commands follow the pattern: command [options] [arguments]
  • Use --help or man to learn about any command
  • Practice is the only way to get comfortable

In the next lesson, we'll dive into navigating the filesystem.