Written By: Ryan Burmeister-Morrison
Welcome to the last and final part of Starting Linux: Hard Mode. This series is a short one, and for a reason. You can’t learn all of Linux in a few blog posts. I’ve been using it for several years, and I’m still learning new things about it. This final part explains what a shell is and what other distros are like, but more importantly, it shows you how to teach yourself, and how to find more help.
In the last couple of sections, I’ve used the term “terminal” when describing what we’re using to use commands. In reality, what we’ve been using is a shell. A shell is a program like any other, while the terminal is what runs a shell. It’s the software that decides how we enter commands, and what happens when we submit them. It’s also the software that handles environment variables and allows you to navigate your filesystem.
There are many different shells, some that work the same way that we’ve been
learning, and some that do things entirely differently. Like Linux, you can
group them into families. The shell that we’ve been using is called
(Alpine Shell), and you will get near-identical functionality in
zsh (Z Shell). You can consider them all to be in a family
because they’re all based on a shell called the Bourne Shell. You also have
csh (C Shell) and
tcsh (T C Shell), the latter derived from the former.
Finally, you have exotic shells such as
fish (Friendly, Interactive Shell),
which are their own thing entirely.
All of these different shells have their merits, and I think it’s worth
exploring them all at one point. However, when starting with Linux, I’d stick
with shells within the same family, as they’re almost always near-identical.
While most concepts carry over to each one and commands work the same
consistently, you may be surprised with some features you find either missing
or added when compared to one you’ve been using. As a simple example,
doesn’t have the
Each shell also has a scripting language, which you use when you type in any
command. Take redirects, for example. Redirects aren’t a program like most
other commands are; instead, it’s a function defined by the shell. There are
several other examples of commands defined by the shell, such as the
keyword. Since this isn’t a programming tutorial, I won’t go in-depth on how to
do shell scripting, but you should research it separately when you can. It’s a
potent tool that you can use to automate a lot of work in the terminal.
In the previous section, you’ve done some shell scripting already when you
~/.profile to persist an environment variable. In doing that, you
leveraged the power of shell scripting to accomplish a task that previously
wouldn’t have been possible. Every shell has configuration files that get
loaded when a user logs into their system. Common to all shells within the same
zsh also offer
~/.zshrc respectively. These files are the preferred files to
edit when trying to perform initial setup after login.
Of all the shells available,
bash is by far the most used. It is the default
in Debian and RedHat based distros, which comprise a large part of all distros.
Fortunately, if you’ve been following this series,
ash is near-identical to
bash because they’re in the same family. You won’t find any significant
differences. If you’re unsure of what shell you’re using,
$SHELL holds the
value of your system’s default shell (the one that you log into).
While Alpine is fantastic and I love it, it’s not a Linux distro for general use. It shines brightest when combined with a tool called Docker or for servers. Instead, you’ll likely want to use a Debian or RedHat distribution (although there are plenty of other great ones). In my opinion, the RedHat distributions are great for work, while Debian distributions are best for home use. For example, I used Fedora at work and Pop!_OS at home.
Every Linux distribution is still Linux, don’t worry. The fundamentals won’t change, such as the filesystem and users. What will change is the default tools that are present and how they use the filesystem. Take package managers, for example. Every operating system worth its salt has one, but every family uses a different one, and they store their data in different places. Fortunately for you, you don’t have to worry about where they store the data in most cases. You only need to know how to use it.
In RedHat distributions, the package manager provided to you is either
dnf. The latter is the newest and preferred tool and is available on any
modern distributions like Fedora. The former is old and is all that’s available
on the more outdated platforms. Both tools operate almost identically, and the
subcommands for both of them are the same. With either, to install a package,
X install Y where
Y is the package to
In Debian distributions, the package manager provided to you is
apt. It’s a
weird one because it’s broken into multiple commands. For example, if you want
to install or remove a package, you use
apt-get, and if you’re going to
modify the cache, you use
apt-cache. More recently, they created
includes all the most common operations, and is the preferred command to use.
dnf, to install a package, you would run
apt install X, where
X is the package to install.
A significant difference between Alpine and these other distributions is the
addition of a desktop environment. A desktop environment is what allows you to
interact with Linux graphically, like any other operating system. The most
popular desktop environment is GNOME and is the default for Debian and RedHat
distributions. Working with GNOME is an entirely different guide, but it’s
designed to be intuitive, and I think it does an excellent job at that. If you
ever get lost, every desktop environment comes with a terminal emulator.
It’s an application called “Terminal” that allows you to use the default shell
as we have been through this guide. You can also have a straight terminal
session that looks like what we’ve been using by pressing
F5. These key combinations switch your Linux session.
By default, you have two graphical sessions and 3 terminal sessions. You can
change back to the graphical session with
typically start on the
F2 session. Switching to these terminal sessions are a
great way to fix problems with the graphical ones, such as freezing, or if you
want a terminal-only experience.
Other than the addition of a desktop environment and a different package manager, most of the Linux experience remains the same. Everything that you’ve learned this far will carry over. However, some great tools are unique to these distros for you to leverage, and you should research what they provide to you. The more tools you know about and can leverage, the easier your life becomes.
So far, we’ve used several commands, and there are many more, but we haven’t
even remotely used them to their full potential. I could make an entire post on
each command in isolation due to how versatile they all are. However, I’ll use
ls command as an example, as the concepts I go over here will extend to
every other command.
Common amongst almost every command is the
--help flag. This flag will
describe the most useful flags that are available to it, as well as any
subcommands that exist. Let’s try calling
ls --help to see the help for
As you can see, there are so many options that we can’t even see them all! To
scroll up in the terminal, press
SHIFT-PAGE UP, and to scroll down, press
SHIFT- PAGE DOWN. We can see the
-a flag that we used in part one, and we
can also see a variation of it that we haven’t seen before:
-A. It’s a useful
flag because we already know that
.. exist, and we don’t need them to
clutter up out output. Every command has many flags, and it’s worth looking at
the help for each one and trying them out to see what each one does. As an
exercise to you, check out the
-l flag, which is used to see who owns a file
Linux also has a manual that we can read to get even more information about a
command. On most systems, the manual is already available by default; however,
it isn’t on Alpine. To install it, install the
apk. To view the manual on any command that provides it, run
X is the command for which you want the manual. For example, if you
need to read the manual for
man man (yes, really). The manual is
handy, but it is hard to read, and I suggest, if you can get away with it, to
--help flag when starting in Linux. If you decide that you do want to
explore the manual, definitely read
man man first. I would also suggest not
reading Alpine’s version, as it doesn’t display all the characters right. You
can also google the manual for any command, as several sites provide the pages
as HTML. For example, here is
the man page for
Through all of this, we haven’t even touched the surface of what Linux can do.
We haven’t learned the super-powerful commands such as
tmux, yet, you already know so much more than most computer users. This
guide’s purpose was to introduce you to Linux and the terminal. From here, all
you have to do is keep using it, and through that, you’ll learn everything you
need to know as each problem comes up. Learning is a journey unique to each
person, and only you can teach yourself properly.
With that said, I’ll be writing posts on individual commands and concepts in the future, so be on the lookout to expand your arsenal!
2019-10-19 23:52 +0000