Linux for Cloud Computing
Today we are going to discuss Linux for Cloud Computing. We’ll cover its prevalence in the cloud, its history, and importance. We will also go over 20 of the top Linux commands for navigating the Linux operating system. If you are a cloud architect, cloud engineer, or technology professional then Linux is a crucial piece of your knowledge skillset.
What is Linux
Linux is an extremely common operating system. 90% of all cloud computing systems run on Linux. Most servers and technology-embedded devices run on Linux. It doesn’t matter if you are a cloud architect, cloud engineer, network engineer, network architect; Linux knowledge is important for your career. It is almost everywhere and knowing how to navigate Linux is crucial for your career.
According to Hosting Tribunal, 100% of the world’s top 500 supercomputers run on Linux. And only 2 of the top 25 websites in the world are not using Linux, Furthermore, according to the same article 96.3% of the world’s top one million servers are all running Linux. That’s approximately 37,000 that don’t and 963,000 that do!
Think about that. The vast majority of all cloud servers are running on a Linux kernel and/or a Linux Hypervisor. Even the cloud’s control plane runs on Linux. The cloud’s control plane is what manages and orchestrates the computing power in the cloud. The data plane (computing) is performed on servers with a Linux kernel and hypervisor. It’s virtually a guarantee that any cloud provider’s servers are running a Linux kernel on their own hypervisor. Each of these servers is likely communicating through a Linux control plane. Essentially, this means that the entire cloud is on Linux. Linux, Linux, Linux.
A Brief History of Linux & How it Works
To know Linux, it helps to understand it’s history. In 1991, Linus Torvalds came up with the Linux kernel. In truth, Linux is not exactly an operating system. It’s a kernel with additional packages and, over the years, Linux has gained even more functionality.
If you want to become a cloud architect, then you must know Linux and understand the architecture of a Linux system. If you want to become a cloud engineer, then you’re going to be building and configuring Linux. Whether you wish to become a cloud architect or cloud engineer, you must understand how the operating system works. To design systems, you must understand them.
Let’s start with the baseline layer. At the base, you’ve got the hardware layer. The hardware layer is your CPU, your DRAM, your disc.
On top of the hardware layer, and before the software layer, are the kernel modules. Kernel modules are pieces of code that get loaded and unloaded onto the kernel in an on-demand fashion. Device drivers are an example of kernel modules. Kernel modules are pieces of code that are placed in and out of the kernel as needed. If you didn’t have these kernel modules you would have to reboot your system every single time its used.
The next piece of the Linux architecture is the actual kernel itself. The kernel is the core of the operating system. The kernel is responsible for everything. Think of the kernel as what manages memory and CPU resources. All or most critical things are performed by the kernel.
After all that, you have a set of system libraries. These are basically pre-compiled pieces of code. Applications on your system will call upon these common system libraries to do their jobs. Above the system libraries is your user processes, your software, and so on. Realistically speaking, that is the architecture of the Linux module.
Once more, it goes:
- Hardware at the base
- Kernel modules & device drivers
- The Kernel itself
- Systems Libraries
- Processes & software
Let’s think about the systems that are running in Linux. Web servers run almost completely on Linux. Servers hosting your databases are hosted almost entirely on Linux. Even your virtualization servers are running on Linux. When you run server virtualization inside of the datacenter, either through KVM or the QEMU hypervisor, you’re running those processes directly through Linux. Even VMware’s ESXi comes from a Linux kernel.
Now Let’s Get Some Hands on Linux Practice
In this section we will walk you through the Linux terminal. For Linux servers most management is performed from the command line. So, if you want to become a great cloud architect, or a talented cloud engineer with an amazing career, then you’ve got to learn Linux. Linux is the basis of all your servers. Servers are your basic infrastructure for everything that goes on the cloud. Your servers host your applications. Your servers host your containers. Your servers host everything. And almost every one of your servers is running on Linux.
Now that you know how the Linux operating system works, we’d like to show you 20 of the top Linux commands.
1. ls – List the Contents of a Directory
Entering ls by itself will simply return the contents of our current directory. We can add options to the end of the command like ls -la or ls -al. This will return all files and hidden files in a long list format. The longlist format will provide additional information of the files such as permissions and owner information.
2. echo – Print / Output Text to the Console
This is one of the first commands you will have likely ever seen in Linux. As you might have guessed, the command repeats, or echoes, everything you type. We’ll give you a basic example and print something onto the screen such as, “Hello, Go Cloud Architects!”
3. touch – Create a File
The touch command allows you to create a file in Linux. We’ll use the touch command to create, or touch, a file named gocloudarchitects. The files created by this command are empty, but you can write inside the files whenever you want.
4. mkdir – Make Directory Command
In Linux, one of the easiest ways to organize things is with a directory. We’ll simply use the make directory command to – you guessed it – make a directory.
5. grep – Global Regular Expression Print / Search for a String or Regular Expression
Grep enables you to search for a string or regular expression. When grep finds a match to your query, it prints that line to console. This is especially useful when combing through substantial files. Below, we’ll grep a file named Research to look for the phrase awards and honors.
6. man – Display the User Manual for Any Command
The man command is probably one of the most useful commands. It gives you a detailed overview of exactly how to use the command. As you can see, Linux has a built-in set of instructions.
7. pwd – Print the Working Directory
This command lets you know exactly where you are located within the file system. It is a simple command, but you will be using it quite frequently.
8. cd – Change Directory
Change your directory and navigate to the directory of your choosing. We’ll change to the root directory in our example.
9. mv – Move
The mv command allows you to move directories and files from one place to another. In the following example, we’ve moved our text file ‘gocloudarchitects’ and into the directory newdir/.
10. head – Output the Beginning (head) of a File / Files
The head command allows you to look at the beginning of a file. As you can see in our example, we’ve looked at the beginning of the file named John Chambers Research.
11. find – Find Command
This command allows you to search for files in Linux. You can use the super user permissions with this command to find things that are outside of your local directory. Below is me searching for my OS-release and being returned the files. (Ignore the permission denied. That’s the mount point for the FUSE interface to the Gnome Virtual Filesystem. It’s a known issue, but is nothing to worry about.)
12. less – Less Command
The less command allows you to peruse a file line by line or one page at a time. This is preferred when the text file is massive. If you used a traditional text editor like vim or nano, you might become overwhelmed by the sheer wall of text. Below is the output of us using the less command on our /etc/os-release file.
13. cat – Concatenate
The cat command is very similar to the previous command. Instead of using a text editor to view a file, like vim or nano. You can use the cat command to display the contents of a file like we did with our John Chambers Research file.
14. tail – Tail Command
The tail command is the exact opposite of the head command. Tail outputs the very last lines of a file.
15. chmod – Change Mode
The Change Mode, or chmod, command allows you to optimize the permissions of a file, directory, or script. Below, we’ve changed the permissions of the gocloudarchitects file so that only the Owner can read, write, or execute. All other Groups and users can only read the file.
16. history – History Command
The history command allows you to see every single line that you have typed inside of your current session. This tool is useful because you may have forgotten what commands you have previously entered.
17. curl – Client URL Command
This command allows you to transfer data over various network protocols. For example, you can pull a file or a series of files from a website.
18. cp – Copy Command
The cp command allows you to copy files and folders and move them to another location. Alternatively, you can create a copy and save a backup. As you can see, I created a backup with the copy command.
19. top – Table of Processes
This command displays the running processes with the Linux system. This information is updated and shown to you in real-time. The useful information is CPU & memory utilization.
20. kill – Kill Command
The kill command allows you to kill an application process. This is particularly useful if a command is going haywire or functioning improperly. You can use the kill command to stop that process completely. As you can see in the example: I’ve killed the process for top by specifying its PID of 5506.
21. Bonus Command: exit – Exit command
As a bonus, we’ve included arguably the most useful Linux command. The exit command. This command is rather straight forward. It’s called the exit command. It allows you to exit from an SSH or terminal session. As you can see below, I’ve entered the exit command. This exit command closed our terminal session and returned us to the Ubuntu desktop.
Cloud Architect Career Development Program
We’ll send you a nice letter once per week. No spam.