4.04 Identify common features and tools of Linux client and desktop OS

Introduction  

Though Windows and Mac operating systems are the most common, another widely used OS kernel is Linux. Linux is open source—meaning the source code is made available to the public for anyone to view, use, modify or distribute.

As a result, there are many different operating systems created on top of the Linux kernel—which acts like the central nervous system of a computer—managing and coordinating all the hardware and software interactions to ensure smooth and efficient operation. These different OS’s are called distributions (or distro for short).

Each distribution can be tailored for different uses and preferences. In this lesson, we are going to learn about features and tools native to all Linux distros.  One of the most prominent attributes will be learning Linux commands.  There exist numerous commands—far too many to explore in this lesson alone.  So, you will find in the flashcard section of this lesson a few common commands to familiarize yourself with and try and possibly memorize. 

Command-Line Interface (CLI) and User Environments 

The Command-Line Interface (CLI) in Linux is a text-based interface used to interact with the operating system. Unlike a Graphical User Interface (GUI) where you use a mouse to click on icons and menus, the CLI requires you to type commands into a terminal window. This might seem daunting at first, but it offers powerful and flexible control over the system.  

Command-Line Interface (CLI)

Graphical User Interface (GUI) showing various elements: radio buttons, checkboxes, and drop-down menus

CLI can be much faster for certain tasks. For instance, creating multiple directories or searching for files can be done with a single command, which would take several steps, clicks and inputs in a GUI environment. CLI also uses fewer system resources compared to a GUI. This makes it ideal for managing servers or systems with limited hardware capabilities. 

CLI allows for scripting, which means you can write a series of commands to automate repetitive tasks. To clearly differentiate, while a command is a single action, a script is a collection of commands that can automate and streamline multiple actions.  This is particularly useful for system administrators and developers. 

While there is a learning curve, mastering the CLI can significantly enhance your productivity and give you deeper control over your system. 

Aside from the CLI, Linux operating systems have core components that define user interaction, such as the kernel, distributions, shells, terminals, and graphical environments. Understanding these helps users effectively navigate and use Linux. 

Kernel 

The kernel is the core software layer of a Linux OS, responsible for: 

  • Managing resources like CPU, memory, and input/output devices. 

  • Facilitating communication between hardware and software. 

It acts as a bridge between applications and the physical hardware. 

Distribution (Distro) 

A Linux distribution (distro) is a complete OS package built around the Linux kernel, including: 

  • A package manager for installing, updating, and managing software. 

  • A software repository containing software packages. 

  • Various shells, utilities, and applications.

Distros are customizable, catering to different needs, from minimal server setups to full desktop environments. Popular distros include Ubuntu, Fedora, Debian, and Arch Linux. They can be community-supported (free) or come with commercial licensing and support for enterprise use. 

Shells and Terminals 

The terms shell and terminal are often used interchangeably, but they refer to different components of the command-line interface (CLI) in Linux. 

A terminal is a program that opens a text-based window where you can enter commands. It acts as a wrapper that allows you to interact with the shell.  It provides the environment for you to type and execute commands. Think of it as the “window” where the command-line interface (CLI) runs. 

GNOME Shell with GNOME Web, Weather and Files (Version 47)

GNOME screenshot

Common terminal programs include: 

  • GNOME Terminal 

  • Konsole 

  • xterm

A shell is a command-line interpreter that processes the commands you enter in the terminal. It interprets your input and executes the corresponding operations.  It acts as the intermediary between the user and the operating system, processing commands and returning the output. 

Popular shells include: 

  • Bash (Bourne Again Shell): Most commonly used, known for simplicity and power. 

  • zsh (Z Shell): Features auto-correction, spelling correction and theming. 

  • ksh (Korn Shell): Offers advanced scripting capabilities 

  • Fish (Friendly Interactive Shell)

Analogy:

Imagine the terminal as a stage where a play is performed. It’s the visible space where the action happens.  The shell is like the director of the play. Mostly unseen by the viewer, it interprets the play script (commands) and directs the actors (system processes) to perform the actions.

In summary, the terminal is the command-line interface (CLI) you use to interact with the shell, and the shell is the program that interprets and executes your commands.

Desktop Environments 

Desktop environments provide a graphical user interface (GUI) with windows, icons, and menus for easier navigation and application use. Common Linux desktop environments include: 

  • GNOME: Simple and easy to use. 

  • KDE: Highly customizable. 

  • Cinnamon: Balances modern and traditional features. 

  • Xfce: Lightweight and efficient. 

GNOME Activities screen

Terminal Emulators 

Within a desktop environment, a terminal emulator allows access to the command-line interface (CLI) in a window, functioning like a standalone terminal but within a graphical interface. It connects to the shell using a pseudoterminal (pty/pts) interface. 

Linux systems with a graphical environment have the ability to run multiple virtual consoles. The X server manages the graphical display output, typically on tty1—which stands for teletypewriter—and now simply refers to a terminal. Historically, it was a physical device used to interact with computers, but now it often refers to virtual terminals or terminal emulators.  Users can switch between multiple terminal consoles (e.g., tty2, tty3) using CTRL+ALT+Fx keys. Each console can run a separate session, allowing multiple users or multitasking. 

Command Structure: 

In Linux, executing tasks and managing the system through commands in the CLI requires inputting them in a structured format. Keeping in mind that Linux commands are case-sensitive, meaning it distinguishes between uppercase and lowercase letters in commands, parameters, and filenames.

Also, very similar to how sentences have a specific structure in any language—as in how individual words are specifically arranged to form a complete thought—the same goes for command structure.   
 
The first part of the input is the command, which may be a path to an executable or simply the executable's name found within directories specified by the PATH environment variable. The system identifies the command until the first space character, after which it will look for any additional arguments, paths or options. 

Let’s break it down: 

Command: This is like telling your computer what you want it to do. It could be the name of a program you want to run, like “notepad” to open a text editor. 

PATH: Sometimes, you need to tell the computer exactly where to find the program. This is like giving directions to a specific folder where the program is stored. 

Executable: This is the actual program or script that does the work. It’s something the computer can run to perform tasks, like opening a file or playing a song. 

Example: When you type a command, the computer looks at the first word you type (before any spaces) to figure out what you want it to do.

If you type:

“notepad myfile.txt,” it sees “notepad” as the command and knows to open the Notepad program to edit “myfile.txt.”. 

Your computer uses the PATH variable to find the notepad program. The PATH variable contains a list of directories where the computer looks for executable files. As in our example, if Notepad is in one of those directories, the computer can find and run it without you needing to specify its exact location. 

So, while the PATH variable isn’t directly shown in the above example, it’s what allows you to simply type ‘notepad’ instead of needing to provide and type out the full path to the Notepad program. It makes running programs much easier and more convenient! 

So, the command structure is just a way for you to tell your computer what program to run and where to find it.  Within the proper structure the command is your instruction, the PATH is the location of the program, and the executable is the program itself that does the work. 

Options (Flags)

Command Options (also known as flags or switches) are special instructions you can add to the command structure to change how it behaves. They usually start with a hyphen (-) or double hyphen (--).  Single-letter options are preceded by a single hyphen (e.g., -a) and Word options by double hyphen (e.g., --all).  The order in which these options (flags) are provided does not affect the command’s function. 

When you type a command, you can add flags to tell the command to do something specific.

For example: 

  • ls -a: The -a flag tells the ls (list) command to show all files, including hidden ones. 

  • cp -r: The -r flag tells the cp (copy) command to copy directories and their contents. 

  • ls --human-readable: The --human option tells the ls command to display file sizes in a ‘human-readable’ format, using units like KB, MB, or GB instead of just bytes.  So, when it is executed it will show you the sizes of files in a way that’s easier to understand, like “4.0K” instead of “4096”.

Arguments

Arguments are any additional inputs, like filenames, that the command uses to perform operations. These must be provided in a specific order, adhering to the command’s syntax.

Combining Commands

The output of one command can be used as the input for another using a pipe (|). For example, command1 | command2 passes the output of command1 to command2. Multiple commands can be executed in sequence on a single line by separating them with a semicolon (;): command1 ; command2. 

Accessing Help and Documentation 

Thankfully, Linux commands offer built-in help using the --help flag, which provides usage details and options. This output can be extensive, so it’s often piped through the more command to view it page-by-page (e.g., ls --help | more).

Alternatively, the man (manual) command provides comprehensive documentation on commands (e.g., man ls).

Navigating the Terminal and Command Tips 

There are some ‘shortcuts’ you can utilize to minimize your keystrokes when inputting commands.  Using the ‘Tab’ key shortcuts to TAB completion which helps auto-fill commands and filenames, speeding up input. The UP and DOWN arrow keys allow you to scroll through previously entered commands. Alternatively, to scroll through command output in some terminal emulators, you would use SHIFT+PAGEUP or SHIFT+PAGEDOWN, and/or CTRL+SHIFT+UP/DOWN ARROW

Understanding the Linux File System 

In Linux, everything on the computer is organized in a single, big "tree" called the file system. Imagine a big filing cabinet with a main drawer at the top and many folders inside it. This is different from Windows, where you have separate "drives" like C: or D:.

1. Root Directory (/) 

  • The root directory is like the main drawer at the top of our filing cabinet. It's where everything starts. 

  • In Linux, this root is simply shown as a single slash (/). All the other folders and files are organized under this root.

2. How Devices Are Represented 

  • In Linux, everything—including your computer's hard drives, USB sticks, and even printers—is treated like a "file" in this filing cabinet. 

    • The first hard drive in your computer might be represented as /dev/sda

    • If you plug in a USB stick, it might show up as /dev/sdb. 

Instead of using different "drive letters" like in Windows (C: for the main drive, D: for a secondary drive), Linux puts all these "devices" into this one big tree, under different "folders." So, your hard drive and your USB drive both live inside this big, organized filing cabinet that starts from /.

3. Important Folders in Linux 

There are several key folders (or directories) inside the root (/): 

  • /home: This is like a folder for users. Each user has their own folder inside /home where they can store their personal files, like documents and pictures. 

  • /etc: Think of this as the settings area. It stores important configuration files that tell the system how to run and manage different programs.

User Account Management in Linux 

In Linux, user management is crucial for maintaining system security and organizing user access and permissions. Here’s an overview of key concepts and commands. 

Root User vs. Regular Users 

  • Root User (Superuser)
    The root user, or superuser, has full control over the system and can perform any action. This account should only be used when absolutely necessary to prevent accidental system changes or security risks. 

  • Regular User Accounts
    During setup, most Linux distributions prompt the creation of a regular user account. This account is used for everyday tasks. Instead of logging in as root, you can temporarily gain higher privileges using specific commands.

Summary 

To really learn Linux, you’re going to need practice. In the meantime, make sure to use the flashcards to learn some of the most important commands and their functions. This will give you a solid foundation, should you choose to develop your Linux skills further.