Linux – Learning the Shell (Part 1)

I ran Slackware back in the late 90s. I also dipped into CentOS in the early 2000s. I’ve been attracted to Linux for many years, yet it was always as a side project. The type of work I was doing professionally was all Windows-based, so that’s where my main focus has been as far as operating systems are concerned. But now that I am serious about transitioning into DevOps, my attention has been drawn back to Linux. This time I want to go beyond a surface-level understanding.

I have decided that some certifications are in order. The first Linux certification I am working on is the LPIC-1. I am reviewing the current exam objectives and have ordered LPIC-1 Linux Professional Institute Certification Study Guide: Exam 101-500 and Exam 102-500 (5th ed., Christine Bresnahan & Richard Blum, 2019). As mentioned in a previous entry, I’ve installed Ubuntu 24.04 LTS as a virtual machine in Hyper-V on my Windows 11 system. Ubuntu is Debian-based, so this will work for the sections on the exam related to Debian package management.

Ubuntu won’t be enough though, as I see the LPIC-1 also tests knowledge of RPM and YUM package management. CentOS, which was based on Red Hat Enterprise Linux (RHEL), has been discontinued. However, Gregory Kurtzer (one of the founders of CentOS) went on to be involved in the Rocky Linux project. Rocky Linux has emerged as one of two main Linux distributions to replace CentOS (the other being AlmaLinux). The main difference between the two are based around how they approach compatibility with RHEL. Rocky Linux is committed to being a 1:1 binary-compatible replacement for RHEL, whereas AlmaLinux uses an Application Binary Interface (ABI) approach. In any case, Rocky Linux and AlmaLinux are both considered replacements for CentOS, which itself was the main free and open-source downstream clone to the commercial distribution, Red Hat Enterprise Linux (all of which use RPM/YUM/DNF package management). I’m going with Rocky Linux as my Red Hat clone because I like the idea of 1:1 binary compatibility. I haven’t installed it yet, but that is near the top of my list.

While reviewing the LPIC-1 exam objectives, and waiting on my study guide, I decided it can’t hurt to go all the way back to the basic fundamentals. With the exception of my recent Ubuntu installation, it has been a long time since I’ve done anything in Linux. Which is why I started a refresher course this morning, The Linux Command Line by William Shotts. I’m using the online version and working through the chapters.

Today I completed Learning the Shell, Sections 1 – 4:

1. What is the Shell?

  • The shell is a command-line interface that lets users interact with the operating system by typing commands.
  • It acts as a bridge between the user and the kernel.
  • Common shells include bash, zsh, and sh, with bash being the default on many Linux systems.
  • Shells allow for automation, scripting, and powerful control over the system.

2. Navigation

The Linux file system is hierarchical, starting from the root directory:

/

Key navigation commands:

# Print the current working directory
pwd
# List files and directories
ls
# Change directory
cd

Paths:

Absolute paths start from / (e.g., /home/user).

Relative paths are based on the current directory (e.g., ../Documents).

3. Looking Around

More detailed file inspection commands:

# Long listing format (shows permissions, ownership, size, date).
ls -l
# Lists all files, including hidden ones.
ls -a
# Determines file type.
file
# Views file contents one screen at a time.
less
# Displays file contents. 
cat
# Copies files. 
cp
# Moves or renames files.
mv
# Removes files.
rm

Wildcards:

# Matches any number of characters.
*
# Matches a single character.
?
# Useful for batch operations. For example:
rm*.txt

4. A Guided Tour

Introduction to key system directories:

# Essential command binaries.
/bin
# Configuration files.
/etc
# User directories.
/home
# Variable data like logs.
/var
# Temporary files.
/tmp

Viewing system info:

# Displays system information.
uname -a
# Shows disk space usage.
df
# Shows file and directory sizes.
du
# Displays running processes.
top

Using man pages:

# Opens manual page for a command.
man

Navigation: use arrow keys, / to search, q to quit.