The Linux Operating System

The Linux Operating System

You may or may not know it yet, but as a cloud professional you MUST have knowledge of the Linux operating system. You will be working extensively with servers, and the vast majority of them are based on the Linux O.S so there’s really no escaping it, at least not at this point in time.

First things first, we were introduced to the features of the operating system and the Linux environment. We also installed a virtual machine on our computer system. A virtual machine or VM is software that allows you to have a digital version of a computer within your physical computer. Your physical computer becomes the ‘host’ and a virtual machine emulates a separate, partitioned computer system within that host. This VM has its own CPU, memory and storage. It also allows you to install any operating system on it that could be same or different from your host machine’s operating system. In my case, I have a Windows computer. After downloading a hypervisor (Virtual Box to be precise), I installed a software called Vagrant. Vagrant makes it easier and faster to spin up virtual machines with your chosen operating system instead of doing it manually. Using vagrant, I downloaded a Linux operating system. So now, I have a Linux operating system available to use on my Windows computer.

It is worthy to note that the Linux O.S has many variations also known as distributions or distros, some of which are Debian, Ubuntu, CentoS, Kali, Mint, etc. We will be using the Ubuntu distribution.

Basic Linux Commands and the CLI

Commands are the instructions you give to your computer to perform tasks. Using the Linux environment as a cloud professional, the command line Interface (CLI) will be your best friend because this is where most of your activities will be carried out. The first set of commands to know are those that aid navigation & file manipulation.

Navigation:

  • pwd: to know your current location or present working directory
  • whoami: to know the current user
  • cd [options]: cd is used to move from one location to another
  • ls [options]: used to list out the contents of a directory/folder
  • uname: to get the name of operating system

File Manipulation:

  • mkdir FOLDER-NAME: to create a new directory/folder
  • touch FILE-NAME: to create a new text file
  • cp FILE-NAME: make a copy of a file
  • mv FILE/DIR NAME: to move a file/directory to another location. It can also be used to rename files
  • rm [options] FILE/FOLDER NAME: to delete a file or empty directory
  • cat FILE-NAME: display contents of a file
  • echo [options]: display contents of a file
  • vi FILE-NAME: opens a new or existing file in an inbuilt text editor called vi
  • nano FILE-NAME: opens a new or existing file in another inbuilt text editor called nano

At the end of this week, I had virtual box and vagrant running on my system with Ubuntu 20.04 LTS installed. I learned about the fundamental command lines used in navigating the Linux CLI, including those used in creating, viewing and editing files & directories.

Tasks for the week:

1. Customise vagrant file with private_network set to dhcp

I achieved this by editing the vagrant file which determines its configurations. After initial installation, this is the default Vagrant file with basic configurations:

Vagrant.configure("2") do |config|
     config.vm.box = "Ubuntu/focal64”
end

Below, I have re-configured my network to ‘private’ and indicate ‘dhcp’ which is a protocol that allocates IP addresses:

Vagrant.configure("2") do |config|
     config.vm.box = "Ubuntu/focal64”
     config.vm.network "private_network", type: "dhcp”
end

2. Learn 10 more Linux commands with descriptions of their respective usage

  • nl FILE-NAME: nl is short for 'number lines' and is used to number each line in a file, making reading & navigation easier particularly in files with considerable amounts of text
  • hostname: used to view a system's hostname (name of computer connected to a network)
  • history: shows all of the current user's previously used commands
  • ip a: shows the internet protocol addresses available on the system
  • timedatectl: displays the current clock settings of the computer system. It is also used to change such settings
  • 'FILE NAME' | grep 'SEARCH TERM': ‘grep’ is a tool used to filter/search. It returns all instances that contain the specified characters
  • find 'DIRECTORY TO START SEARCH' -type 'FILE TYPE' -name 'FILE NAME': ‘find’ is used to search for files in specified areas of the system
  • sudo COMMAND: sudo means "super user do". It gives a user temporary elevated access & privileges to run commands ordinarily only available to the root user
  • head [options] FILE-NAME: shows the first (specified) number of lines of a file’s content
  • tail [options] FILE-NAME: shows the last (specified) number of lines of a file’s content

3. Change your system’s time-zone

  • $ timedatectl

This returned the system’s current date, time & time-zone which was UTC +0000 by default

  • $ timedatectl list-timezones | grep Lagos

This lists all the available time-zones. Grep filters results with the term ‘Lagos’ which is my time-zone. The returned output was Africa/Lagos

  • $ sudo timedatectl set-timezone Africa/Lagos

This changes the time-zone to Africa/Lagos

  • $ timedatectl

To verify changes made