Introduction to Linux for complete beginners

Introduction to Linux for complete beginners

If you are someone who is looking for some basic knowledge of Linux for a career in the Tech Industry specifically Cloud, DevOps, and Linux Administration then this blog tends to cover all the aspects of a Linux operating system from a beginner's perspective and is going to give you an overall overview.

What is Linux?

Linux is a family of free and open-source operating systems based on the Linux kernel. Operating systems based on Linux are known as Linux distributions or distros. Examples include Debian, Ubuntu, Fedora, CentOS, Gentoo, Arch Linux, and many others.

The initial release of Linux was on Sept 17, 1991, created by Linus Torvalds and had been in active development since then and has proven to be extremely versatile and adaptable. The source code can be modified and distributed to anyone commercially or noncommercially under the GNU General Public License. Initially, Linux was created for personal computers and gradually it was used in other machines like servers, mainframe computers, supercomputers, etc. Nowadays, Linux is also used in embedded systems like routers, automation controls, televisions, digital video recorders, video game consoles, smartwatches, etc

Why choose Linux?

  • Open-source
  • Highly secure
  • Access to source code
  • Runs faster

Linux architecture

Linux Architecture.jpg

Shell:- It is an interface between the kernel and the user. It can afford the services of the kernel. It can take commands through the user and run the functions of the kernel. The shell is available in distinct types of OSs. These operating systems are categorized into two different types, which are the graphical shells and command-line shells.

The graphical line shells facilitate the graphical user interface, while the command line shells facilitate the command line interface. Thus, both of these shells implement operations. However, the graphical user interface shells work slower as compared to the command-line interface shells.

Shell types:

  • Bourne shell
  • C shell
  • Z shell
  • Bourne again shell

Kernel:- A kernel is the core of the Linux-based operating system. It is responsible for each of the major actions of the Linux OS. This operating system contains distinct types of modules and cooperates with underlying hardware directly. The kernel facilitates the required abstraction for hiding details of low-level hardware or application programs to the system. These are some of the important kernel types which are mentioned below:

  • Monolithic Kernel
  • Microkernels
  • Exo kernels
  • Hybrid kernels

Hardware layer:- Linux operating system contains a hardware layer that consists of several peripheral devices like CPU, HDD, and RAM.

Hands-on experience with Linux OS

How to choose the best Linux distro for you if you are a programmer?

There are hundreds of distros to choose from overall. And there are quite a lot of distros recommended for programmers to choose from. To help you narrow down the choice, you should consider the following points:

What kind of programming do you plan on doing? If you plan on focusing on servers, you’re better off with Ubuntu, CentOS, Fedora, or other server Linux distros. The switch over to RHEL (which is used in a lot of enterprises) will be much easier if you’ve been using CentOS or Fedora. This will help you choose the best programming distro for you.

Virtual Machine is the first thing you need to install if you want any kind of Linux distros: Windows Mac

Ubuntu – best for beginner programmers

Pre-installed with a lot of useful software and apps, Ubuntu makes it easy for beginners, and for programmers. It has a stable release schedule – so the LTS (Long-Term Support) releases have a longer support period. If you prefer stability and peace of mind, it’s great.

Click on the link based on the operating system you are using: For WindowsFor Mac

Fedora – best for server programmers

It has different Spins and Editions to choose from, including Workstation (the one meant for desktops), Server, and an IoT edition. This makes it a great option for sysadmins and programmers that are focusing on servers. It’s similar to CentOS and RHEL, which are some of the most popular distros for servers. People often use Fedora as a daily driver and they use it as a gateway to RHEL and CentOS.

Click on the link based on the operating system you are using: For Windows For Mac

Kali Linux – best for security programmers

Kali Linux is a Pentesting and ethical hacking distro that’s definitely not recommended for beginners. However, if you are getting into security or if you are experienced with digital forensics, networking, and advanced security, this distro is made for you.

Click on the link based on the operating system you are using: For Windows For Mac

Raspberry Pi OS – best for students and Python programmers

This modest computer’s official Raspbian/Raspberry Pi OS comes loaded with many programming tools, connector pins, and other beneficial ports. This makes it a perfect Linux OS for learning embedded systems programming.

It has BlueJ, Geany, Greenfoot, Mathematica, Python, Node-RED, Scratch, and other tools for making your learning process more effective.

Click on the link based on the operating system you are using: For Windows For Mac

Basic commands to try out in CLI

Now you might be wondering, what is CLI(Command Line Interface)? In the 1960s, CLI was used intensively.

Back then, people had only a keyboard as an input device and the computer screen could only display text information. Operating systems like MS-DOS used the CLI as the standard user interface.

Basically, users had to type a command on the CLI to perform tasks, as this was the only way to communicate with the computer.

After typing a command, the result users got would be either text information or specific action performed by the computer. That being said, typing the right command is the key.

If users type the wrong command, chances are they’ll end up deleting the wrong files or accidentally closing the program before saving their work. This is what people consider as the main drawback of using CLI.

Apart from that, operating systems started to develop an attractive way of computing, using GUI (Graphical User Interaction). GUI itself was phenomenal because of the use of buttons and menus to represent specific commands. This approach has been proven to be very intuitive.

Today, GUI has become a common way of computing. However, most operating systems still offer a combination of CLI and GUI.

For example, Mac users can search "Terminal" and type dee$ cal in Terminal to get the Calendar application.

Commands to try out:

pwd — When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash( / ). The user directory is usually something like "/home/username".

image.png

ls — Use the "ls" command to know what files are in the directory you are in. You can see all the hidden files by using the command ls -a.

image.png

cd — Use the "cd" command to go to a directory. For example, if you are in the home folder, and you want to go to the downloads folder, then you can type in “cd Downloads”. Remember, this command is case sensitive, and you have to type in the name of the folder exactly as it is. But there is a problem with these commands. Imagine you have a folder named “Raspberry Pi”. In this case, when you type in “cd Raspberry Pi”, the shell will take the second argument of the command as a different one, so you will get an error saying that the directory does not exist. Here, you can use a backward slash. That is, you can use “cd Raspberry\ Pi” in this case. Spaces are denoted like this: If you just type “cd” and press enter, it takes you to the home directory. To go back from a folder to the folder before that, you can type cd .. The two dots represent back.

mkdir & rmdir — Use the mkdir command when you need to create a folder or a directory. For example, if you want to make a directory called “DIY”, then you can type mkdir DIY. Remember, as told before, if you want to create a directory named “DIY Hacking”, then you can type mkdir DIY\ Hacking. Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.

rm - Use the rm command to delete files and directories. Use rm -r to delete just the directory. It deletes both the folder and the files it contains when using only the rm command.

touch — The touch command is used to create a file. It can be anything, from an empty txt file to an empty zip file. For example, touch new.txt.

hostname — Use hostname to know your name in your host or network. Basically, it displays your hostname and IP address. Just typing “hostname” gives the output. Typing in “hostname -I” gives you your IP address in your network.

image.png

man & --help — To know more about a command and how to use it, use the man command. It shows the manual pages of the command. For example, “man cd” shows the manual pages of the cd command. Typing in the command name and the argument helps it show which ways the command can be used (e.g., cd –help).

cp — Use the cp command to copy files through the command line. It takes two arguments: The first is the location of the file to be copied, the second is where to copy.

mv — Use the mv command to move files through the command line. We can also use the mv command to rename a file. For example, if we want to rename the file “text” to “new”, we can use mv text new. It takes the two arguments, just like the cp command.

ping — Use ping to check your connection to a server. Wikipedia says, "Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network". Simply, when you type in, for example, ping google.com, it checks if it can connect to the server and come back. It measures this round-trip time and gives you the details about it. The use of this command for simple users like us is to check your internet connection. If it pings the Google server (in this case), you can confirm that your internet connection is active!

image.png

du — Use duto know the disk usage of a file in your system. If you want to know the disk usage for a particular folder or file in Linux, you can type in the command df and the name of the folder or file. For example, if you want to know the disk space used by the documents folder in Linux, you can use the command du Documents. You can also use the command “ls -lah” to view the file sizes of all the files in a folder.

I had tried to put in all the basic commands that are necessary for you to learn, Nonetheless I will try to mention many references that are available out there.

Click here: Tutorial on Linux by Edureka!

Click here: If you are someone who is looking into DevOps then you might have that perfect video

As knowledge increases, wonder deepens - Happy Learning!