0% found this document useful (0 votes)
10 views

Linuxpocketguide4thedition Preview

Linux is a free, open-source operating system that serves as an alternative to Windows and macOS, powering most internet servers and various devices. It consists of four main components: the kernel, supplied programs, the shell, and an optional graphical desktop environment, with a focus on command-line usage. Linux is highly configurable with numerous distributions (distros) that cater to different needs, and this book emphasizes the command-line aspects of Linux.

Uploaded by

elevenasamala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Linuxpocketguide4thedition Preview

Linux is a free, open-source operating system that serves as an alternative to Windows and macOS, powering most internet servers and various devices. It consists of four main components: the kernel, supplied programs, the shell, and an optional graphical desktop environment, with a focus on command-line usage. Linux is highly configurable with numerous distributions (distros) that cater to different needs, and this book emphasizes the command-line aspects of Linux.

Uploaded by

elevenasamala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CHAPTER 1

Essential Concepts

What’s Linux?
Linux is a free, open source operating system (OS) that’s an
alternative to Microsoft Windows and Apple macOS. Linux
powers most of the servers on the internet. It operates behind
the scenes on every Android mobile phone and Chromebook,
and on millions of network-connected devices like routers,
firewalls, and robotic cow-milking systems (seriously). It also
runs fine on desktop and laptop computers.
Linux has four major parts, shown in Figure 1-1:
The kernel
Low-level software. It controls the hardware and basic
functions like process scheduling and networking. Few
users interact with the kernel directly.
Supplied programs
Thousands of programs for file handling, text edit‐
ing, software development, web browsing, audio, video,
encryption, mathematics…you name it. These programs
talk to the kernel. Programs that run on the command line
are called commands.

19
The shell
A Linux program for running commands and displaying
the results. Linux has an assortment of shells with differ‐
ent features. This book focuses on a shell called bash,
which is often the default for user accounts. Some other
shells are dash, fish, ksh (Korn shell), tcsh (TC shell, or
T shell), zsh (Z shell), and to a lesser extent, busybox. All
shells have similar functions, though their usage varies.
Graphical desktop environment (optional)
A UI with windows, menus, icons, mouse support, and
other familiar GUI elements. Some popular environments
are GNOME and KDE Plasma. Most applications built for
GNOME can run in KDE and vice versa.1
This book focuses on the command-line parts of Linux, namely
the supplied programs and the shell. Windows and macOS
have command-line interfaces too (cmd and powershell on
Windows, Terminal on the Mac), but most of their users stick
with the GUI and might never see or need a command line. On
Linux, the shell is critical. If you use Linux without the shell,
you are missing out.
Linux is extremely configurable and comes in hundreds of vari‐
eties that serve different needs and tastes. Each variety is called
a distro (short for <distribution=). All distros share some core
components but may look different and include different pro‐
grams and files. Some popular distros include Mint, Ubuntu,
Manjaro, Arch, Gentoo, Red Hat, and OpenSUSE, among oth‐
ers. The core material in this book should apply to every distro.

1 GNOME, KDE, and other environments are built on a common win‐


dowing system that is either X or Wayland. To see which system you’re
using, run the command echo $XDG_SESSION_TYPE.

20 | Chapter 1: Essential Concepts


Figure 1-1. The four major parts of Linux, conceptually. Low-level
kernel functions are called by programs, which are invoked in a shell,
which can be launched by a graphical desktop.

Launching a Shell
Where do shells come from? Sometimes Linux will launch one
for you automatically. This is often the case when you log in
over a network using ssh or a similar tool. The first significant
thing you see is a shell prompt awaiting your command.
Other times, you have to launch a shell manually. This is com‐
mon when using a graphical desktop full of icons and menus
with no shell in sight. In such cases, you need a GUI applica‐
tion called a terminal or terminal program that runs shells in
a window. The sidebar <Shell Versus Terminal= on page 22
clarifies the difference between shells and terminals.

What’s Linux? | 21
Every distro with a graphical desktop includes at least one
terminal program, but you might have to hunt for it. Search for
an application, icon, or menu item named Terminal, Konsole,
xterm, gnome-terminal, uxterm, or something similar, and run
it to open a terminal. Also try pressing Ctrl-Alt-t (hold the
Control and Alt keys and press T), which opens a terminal in
some environments.

Shell Versus Terminal


A shell is a command-line interface for launching Linux com‐
mands by typing plain text. It prints a prompt and waits for
your command:

A terminal is a program that opens a window and presents a
running shell, shown in Figure 1-2. It’s like a graphical wrapper
around a shell. A terminal adds menus, scrollbars, copy and
paste, and other GUI features that support the shell.

Figure 1-2. A terminal program opens a window that runs a shell.

Command-Line Warm-Up
To give you a feel for Linux, here are 10 simple commands to
try right now in a shell. Type them exactly, including capital

22 | Chapter 1: Essential Concepts


and small letters, spaces, and all symbols after the prompt. At
the end of each command, press Enter.2
Display a calendar for November 2023:
→ cal nov 2023
November 2023
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
List the contents of the /bin directory, which contains many
commands:
→ ls /bin
bash less rm
bunzip2 lessecho rmdir
busybox lessfile rnano

Count the number of visible items in your home directory
(represented here by a variable, HOME, that I discuss later):
→ ls $HOME | wc -l
8 Your value may be different

See how much space is used on a partition of your hard disk:


→ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 78G 30G 48G 61% /
Watch the processes running on your computer (press <q= to
quit):
→ top -d1

2 If you see an error message <command not found,= don’t worry: a


command probably isn’t installed on your system. See <Installing Soft‐
ware Packages= on page 195.

What’s Linux? | 23

You might also like