Learn Linux Quickly, 1st Edition was written over the course of two years, from May 2018 to May 2020. This book implements a modern approach to learning Linux, and you will most definitely get to appreciate its uniqueness and friendly tone.
About the Author
Ahmed Alkabary is a professional Linux/UNIX system administrator working at IBM Canada. He has over seven years of experience working with various flavors of Linux systems. He also works as an online technical trainer/instructor at Robertson College.
Ahmed holds two BSc degrees in Computer Science and Mathematics from the University of Regina. He also holds the following certifications:
- Red Hat Certified System Administrator (RHCSA).
- Linux Foundation Certified System Administrator (LFCS).
- AWS Certified DevOps Engineer – Professional.
- AWS Certified Solutions Architect – Associate.
- Azure DevOps Engineer Expert.
- Azure Solutions Architect Expert.
- Cisco Certified Network Associate Routing & Switching (CCNA).
Why this Book?
If you have always wanted to learn Linux but are still afraid to do so, this book is for you! A lot of people think of Linux as a sophisticated operating system that only hackers and geeks know how to use, and thus they abort their dream of learning Linux. Well, let me surprise you! Linux is simple and easy to learn, and this book is the ultimate proof! You may have stumbled across a variety of sources that all explain Linux in a complicated and dry manner. This book does exactly the opposite; it teaches you Linux in a delightful and friendly way so that you will never get bored, and you will always feel motivated to learn more. Learn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, intermediate and advanced Linux users will still find this book very useful as it goes through a wide range of topics.
How to use this Book
I have intended this book to be used in two ways:
- As an educational text. You will read this book from the start chapter by chapter. You will also do the exercises at the end of each chapter to reinforce your learning experience.
- As a reference. You may forget how to accomplish a particular task in Linux. Learn Linux Quickly is an excellent book to have on your bookshelf when you need a quick refresher on how to accomplish any task in Linux.
It took me almost two years to write this book. I would appreciate any reviews or feedback, so please don’t forget to leave a review after reading the book. Cheers!
Chapter 1: Your First Keystrokes
I want to welcome you to the first chapter of this book. When you read this book, you will feel like you are reading a story, but this is not an ordinary story, it is the Linux story. In this chapter, you will learn about the origin of Linux and the impact of Linux on today’s World. You will also learn how Linux is shaping the future of Computing. Finally, you will learn how to install Linux as a virtual machine on your computer. So without further ado, let’s jump-start into it.
A Little Bit of History
The story of Linux began in 1991 when Linus Torvalds, who was a computer science student at the University of Helsinki in Finland, began writing a free operating system as a hobby! It is funny to realize now that his side hobby project became the world’s biggest open-source project in history. Oh, and in case you haven’t figured it out already, this free operating system was Linux. There are a lot of definitions out there on the web for open-source, and some of them are somewhat confusing for the inexperienced reader, so here is a simplified explanation:
WHAT IS OPEN-SOURCE?
An open-source project is a software project that has its source code made accessible for the public to view and edit.
The source code is simply the collection of code (programs) used to develop soft- ware; in the context of Linux, it refers to the programming code that built the Linux operating system. Now since you know that Open Source means, it is easy to imagine what closed source is:
WHAT IS CLOSED-SOURCE?
A closed-source project is a software project that has its source code NOT made accessible for the public to view and edit.
Linux is the ultimate most famous example of an open-source project. On the other hand, Microsoft Windows is the most famous example of a closed-source project.
Some people don’t know what an operating system is, but don’t worry; I got you covered. Here is a simple definition for an operating system:
WHAT IS AN OPERATING SYSTEM?
An operating system is a software program that manages a computer’s resources such as memory and disk space. It also allows a computer’s hardware and software to communicate with each other. Operating Systems may also include other applications: text editor, file manager, graphical user interface, software manager, etc.
There are a lot of different operating systems out there; here are a few examples:
- Microsoft Windows
- Apple IOS
Keep in mind that this list is very short and is in no way comprehensive. There is a massive number of operating systems out there, and it is hard even to count them all.
When talking about operating systems, we have to mention the kernel, which is the core of any operating system.
WHAT IS A KERNEL?
A kernel is simply the core of any operating system. It is the part of the operating system that organizes access to system resources like CPU, memory, and disk.
Notice that in the definition, I said the kernel is a part of the operating system. And Figure 1 can help you visualize the difference between a kernel and an operating system.
Figure 1: Operating System vs. Kernel
Unlike Microsoft Windows or macOS, Linux has a lot of different flavors; these flavors are called distributions, and they also referred to as distros for short.
WHAT IS A LINUX DISTRIBUTION?
Since Linux is open-source, many people and organizations have mod- ified the Linux kernel along with other components of the Linux operating system to develop and customize their own flavor of Linux that suits their needs.
There are literally hundreds of Linux distributions out there! You can go to www.distrowatch.com to check out the enormous list of Linux distros.
The good thing about distrowatch.com is that it shows you the popularity ranking of all the Linux distros in the world. You will even see that some Linux distros are designed with a specific purpose in mind. For example, Scientific Linux is a popular Linux distro among many scientists as it contains a lot of scientific applications preinstalled, which makes it the number one Linux choice among the scientific community.
Linux Today and the Future
In 1991, Linux was just a little baby. But this baby grew massively, and it became so popular. Today, Linux powers over 90% of the world’s top supercomputers. And to add to your surprise, you may have been using Linux for years without noticing, How? Well, if you ever used an Android smartphone, then you have used Linux, and that’s because Android is a Linux distribution! And if you still don’t believe me, go to distrowatch.com and search for Android.
On a more serious matter, the majority of government servers run Linux, and that’s why you will see a lot of government technical jobs requiring Linux skilled individuals. Also, big companies like Amazon, eBay, PayPal, Walmart, and many others rely on Linux to run their advanced and sophisticated applications. Furthermore, Linux dominates the cloud as more than 75% of cloud solutions run Linux.
The Linux story is truly inspiring. What was once a hobby is now literally dominating the internet, and the future even looks more promising for Linux. Famous car manufacturers and automakers like Lexus and Toyota are now adopting Linux technologies like Automotive Grade Linux (AGL). You can find more information on www.automotivelinux.org
Linux also runs on many embedded devices and is the backbone of the popular Raspberry Pi, Beagle Bone, and many other microcontrollers. You may even be surprised to know that some washing machines run on Linux! So every time you go and wash your clothes, take a moment, and be thankful for having Linux in our lives.
Installing a Linux Virtual Machine
There are a variety of ways to install a Linux System. For example, if you are currently running Windows as your primary operating system, then you may be able to dual boot Linux alongside Windows, but this method is not beginner-friendly. Any error in the installation process may cause you a lot of headaches, and in some cases, you won’t even be able to boot Windows anymore! I want to save you a lot of pain and agony, so I am going to show you how to install Linux as a virtual machine.
WHAT IS A VIRTUAL MACHINE?
A virtual machine is simply a computer running from within another computer (host). A virtual machine shares the host resources and behaves exactly like a standalone physical machine.
You can also have nested virtual machines, which means that you can run virtual machine from within another virtual machine.
The process of installing a virtual machine is straightforward; you only need to follow the following steps:
- Install VirtualBox (or VMware Player).
- Download an ISO image of any Linux distribution.
- Open up VirtualBox and begin the installation process.
The first step is to install VirtualBox, which is a cross-platform virtualization application that will allow us to create virtual machines. VirtualBox is free, and it works on macOS, Windows, and Linux. A quick google search: VirtualBox download will get the job done. If you are feeling a bit lazy, you can download VirtualBox at the following link: www.virtualbox.org/wiki/Downloads
After you have installed VirtualBox, you now need to download an ISO image of any Linux distribution. For this book, you will be using Ubuntu, which is arguably the most popular Linux distribution among beginners. You can download Ubuntu at the following link: www.ubuntu.com/download/desktop
I recommend that you download the latest Ubuntu LTS (Long Term Support) version as it is well tested and has better support.
For the last step, you need to open VirtualBox and create a Linux virtual ma- chine with the Ubuntu ISO image you have downloaded from Step 2.
When you open VirtualBox, you have to select New from the menu bar.
Figure 2: Creating a New Virtual Machine
Then you need to choose the name and type of your new virtual machine.
Figure 3: Choose Name and Type
After that, click on Continue and select how much memory you want to give to your virtual machine. I highly recommend 2GB (Gigabyte) or more. For example, here (in Figure 4), I choose to give my virtual machine 4096MB of memory (RAM), which is equivalent to 4GB.
Figure 4: Choose Memory Size
After that, click on Continue and make sure that Create a virtual hard disk now is selected, as shown in Figure 5, then click on Create.
Figure 5: Create a Hard Disk
After that, Choose VDI (VirtualBox Disk Image) as shown in Figure 6, then click on Continue.
Figure 6: Hard Disk File Type
Now select Dynamically allocated, as shown in Figure 7, then click on Continue.
Figure 7: Storage on Physical Hard Disk
Now you can select the hard disk size of your virtual machine. I highly recommend you choose 10GB or higher. Here (in Figure 8), I chose 20GB for my virtual machine.
Figure 8: Hard Disk Size
After selecting the hard disk size, click on Create to finish creating your virtual machine.
Figure 9: Virtual Machine is Created
You can click on the green Start button to launch your virtual machine. You will then have to select a start-up disk, as shown in Figure 10.
Figure 10: Select start-up disk
Choose the Ubuntu ISO image that you have downloaded and then click on Start to launch the Ubuntu Installer, as shown in Figure 11.
Figure 11: Ubuntu Installer
You can now select Install Ubuntu. Next, you will have to choose the language and the keyboard layout. After that, you should keep accepting the defaults.
You will eventually come to the step of creating a new user, as shown in Figure 12.
Figure 12: Create a new user
I chose username elliot because I am a big fan of the TV Show Mr. Robot and for the fact that Elliot was using Linux while he was casually hacking E Corp! I highly recommend you choose elliot as your username as it will make it easier for you to follow along with the book.
You can then click on Continue, and the system installation will begin, as shown in Figure 13.
Figure 13: System Installation
The installation process will take a few minutes. Hang on there or make yourself a cup of coffee or something while the installation finishes.
You will have to restart your virtual machine when the installation is complete, as shown in Figure 14.
Figure 14: Installation Complete
You can click on Restart Now. After that, it may ask you to remove the installation medium, which you can do by selecting Devices → Optical Drives → Remove disk from virtual drive.
Finally, you should see your Sign In screen, as shown in Figure 15.
Figure 15: Ubuntu Sign In
You can now enter your password and Hooray! You are now inside of a Linux System.
There are other ways you can use to experiment with a Linux system. For ex- ample, you can create an account on AWS (Amazon Web Services) and launch a Linux virtual machine on an Amazon EC2 instance. Likewise, you can create a Linux virtual machine on Microsoft Azure. So consider yourself lucky to be living in this day and age! Back in the day, it was a painful process to get up and running with Linux.