Kahibaro
Discord Login Register

Terminal and Shell Basics

Understanding the Terminal

The terminal is a text-based interface that lets you interact with your Linux system by typing commands instead of (or in addition to) using windows, icons, and buttons.

At a practical level, you need to know:

Opening a Terminal

How you open a terminal depends on your desktop environment and distribution, but common methods include:

You don’t need to memorize all of these; learn one way that works on your system.

The Terminal vs the Shell

These two words are often used together:

You can think of:

You can run different shells inside the same terminal program.

Terminal Prompt Basics

When you open a terminal, you usually see something like:

bash
user@hostname:~$

Common parts of a prompt:

The exact look varies by distribution and shell theme, but the last character ($ or #) is especially important: it tells you whether you’re running as a normal user or root.

You type your commands after the prompt and press Enter to run them.

Basic Command Workflow

The general workflow in a terminal is:

  1. Terminal shows a prompt.
  2. You type a command line.
  3. The shell interprets it and runs the command program.
  4. The command prints output (or errors).
  5. Control returns to the shell, and you see a new prompt.

You will learn command structure in another chapter; here we focus on how to use the terminal around that structure.

Command Line Editing Essentials

You rarely type a command perfectly first try. The shell provides basic editing features.

Try these inside a terminal (they don’t produce visible characters):

These shortcuts work in most Linux shells (especially Bash). They make editing commands much faster than repeatedly pressing Backspace.

Running Commands and Getting Output

A few basic experiments:

After each command, you’ll see any output printed, followed by a new prompt.

If a command seems to “do nothing” and returns to a prompt, it likely just completed successfully with no message. Many Unix tools are quiet unless there’s something specific to say.

Interrupting and Stopping Commands

Sometimes a command runs for a long time or gets “stuck.” You can usually interrupt it:

If Ctrl+C doesn’t work, the program might be ignoring it, or it might be waiting for something else (e.g. network, disk). How to fully manage and kill processes is covered in a later chapter; for now memorize:

Clearing and Scrolling

Two common tasks:

Clearing the screen doesn’t erase history; it just moves the prompt to the top and hides earlier output. You can still scroll back.

Basic Command History

The shell keeps a history of commands you’ve typed, even across sessions.

Simple usage:

You’ll learn more advanced history usage in a dedicated chapter; for now, remember that Up Arrow is the fastest way to rerun or edit previous commands.

Autocomplete Basics

Most shells support tab completion:

Examples:

If there are multiple possibilities, pressing Tab twice often shows a list of options.

This dramatically reduces typing and typos; get into the habit of pressing Tab often.

Exit and Close Behavior

To leave the shell:

What happens next:

If you accidentally close a terminal window while a command is running, that command usually stops (unless you’ve explicitly detached it; that’s covered elsewhere).

Multiple Terminals and Tabs

Modern terminal emulators support:

Look for:

Each tab/window runs its own shell session. This is useful to:

Common Terminal Programs

The exact terminal emulator program may differ:

You can usually find which one you’re using via the window title or from the “About” menu. For everyday use, you can just think of all of them as “the terminal.”

Text-Only Consoles (Virtual Terminals/TTYS)

Linux systems also provide virtual consoles (text-only login screens) independent of the graphical desktop.

These are useful if:

From a learning perspective, they behave just like a terminal window, but full-screen and purely text.

Basic Safety Tips in the Terminal

As you get comfortable, keep these simple rules in mind:

You’ll learn more about sudo, permissions, and system commands later, but these habits help avoid accidental damage while practicing in the terminal.


This chapter focused on the environment where you type commands: the terminal and basic shell interaction. Other chapters in this part will build on this by explaining shell types, command structure, getting help, and using history and completion more effectively.

Views: 27

Comments

Please login to add a comment.

Don't have an account? Register now!