Introduction to Linux
What is Linux?
So, what exactly is Linux? Well, Linux is actually open-source code. But wait, what does that mean? Open source means it’s free to use, modify, and distribute the code. Isn’t that amazing? Linux was founded by Linus Torvalds back in 1991. At that time, UNIX was the go-to operating system used at his university, but it was rather pricey! Linus wanted to create a free alternative, so he embarked on a personal project to develop an operating system that others could use without paying hefty fees. Now that you have some background on Linux, let’s explore more!
The Linux Kernel
Next, let’s dive deeper into the Linux kernel, which is a fundamental component of the operating system. Think of the kernel as the heart of the OS; it is the central part that governs and controls all the essential operations of the system. Without it, the operating system wouldn't function as intended. Here are some key functions of the kernel that highlight its importance.
- Process Management: The kernel is responsible for managing processes, which are essentially running programs. It oversees the creation, execution, and termination of these processes, ensuring that they run smoothly and efficiently. It allocates CPU time to each process and manages their states—whether they are running, waiting, or stopped.
- Memory Management: The kernel plays a crucial role in memory management by allocating and deallocating memory to processes as needed. It ensures that each process has sufficient memory to operate while optimising the use of RAM. This function prevents memory leaks and fragmentation, contributing to the overall performance and stability of the system.
- Device Management: The kernel handles input/output (I/O) operations, facilitating communication between the hardware devices and the software applications. It manages the interaction with various devices, such as printers, keyboards, and storage drives, allowing them to function seamlessly within the operating system.
- Network Management: The kernel manages network connections, ensuring that data can be sent and received across networks. It handles the protocols and processes that allow different devices to communicate, making it possible for the system to access the internet and other network resources.
- Security Management: Security is a critical aspect of any operating system, and the kernel plays a vital role in protecting system resources from unauthorized access. It implements various security measures to ensure data integrity and confidentiality, safeguarding the system against potential threats and vulnerabilities.
Understanding the functions of the Linux kernel is essential for anyone looking to gain a deeper knowledge of how Linux operates. It acts as the bridge between the hardware and the user applications, making it a key area of focus for both beginners and experienced users alike.
Linux Distributions
Now you have a clear idea about what the kernel is. The world started to get this open-source code and make modifications to it. This is called distributions. People create their modifications and make different kinds of operating systems based on the Linux kernel. Examples of distributions include CentOS, Fedora, Parrot, Ubuntu, and SUSE.
Major Linux Distributions
Debian, Red Hat (specifically Red Hat Enterprise Linux or RHEL), and SUSE (specifically SUSE Linux Enterprise Server or SLES) are all major Linux distributions—operating systems built on the Linux kernel but differentiated by their development models, package management, and target audiences. Here’s a brief overview:
- Debian: A community-driven, free distribution known for its flexibility and stability.
- Red Hat: Offers a commercially supported enterprise-focused system with extensive software compatibility.
- SUSE: A commercial enterprise distribution with strong roots in Europe, also providing commercial support and enterprise features.
Distribution Categories
These major distributions can be divided into commercial and non-commercial:
- Commercial: Red Hat, SUSE, and SLES.
- Non-commercial: Ubuntu, Debian, and others.
You might wonder, "Wait, you said before that Linux is open source? What do you mean by commercial and non-commercial?" Yes, I mentioned that the Linux kernel is open source, but the distributions are those that have modifications. For enterprise-level use, they create commercial versions from that.
How to Use Linux on Windows
Now that you have a clear idea about what Linux is, why it was introduced, its history, and its distributions, let’s discuss how to use Linux on our computers. Today, I learnt three methods to use Linux on a Windows operating system:
- Virtual Machine: Install Ubuntu or another distribution.
- WSL (Windows Subsystem for Linux): Allows you to run a Linux environment directly on Windows.
- AWS Free Tier: A great option for those interested in DevOps.
Setting Up a Virtual Machine
Regarding installing a virtual machine, I wanted to mention an important point from my instructor today. At this time, Ubuntu 24 is available, but he recommended using Ubuntu 22 because of its compatibility. We are mainly focusing on learning and understanding Linux.
Now, you might ask, "Why Ubuntu?" There are many other distributions available, but for learning and practice, Ubuntu is the best choice. However, there is a misunderstanding that Linux is all about Ubuntu. No, Ubuntu is not Linux; it is a distribution of Linux. Let’s move on to the facts.
Configuring VirtualBox Settings
As shown in the image, there are settings to adjust. Click on that, and you will see a pop-up. Select "Expert". In the General section, choose the "Advanced" tab. Under that, you will see shared clipboard and drag-and-drop options. For those, select "Bidirectional". Through this, you will be able to copy and paste things from your Windows OS to the virtual machine.
Next, after making the above changes, move into the network settings. There, you will see four adapters. In normal machines, we can also connect several network cards. For the first adapter, the default choice is NAT; keep it as it is. Then move to the second adapter (Adapter 2).
Then, select the Host-only adapter as attached.
Network Adapter Types Now, why did I suggest selecting NAT and Host-Only Adapter? I’ll explain:
- NAT: Allows your machine to connect to the internet through Wi-Fi, meaning the virtual machine can access the network, but you can’t host anything on it.
Host-Only Adapter: Creates a new connection for networking and sharing. You can see in the picture that there is "Ethernet 4". It is the VirtualBox Host-Only Ethernet connection, which takes IP ranges from 192.168.56.1 and above. You can assign 192.168.56.10 to your virtual machine, allowing you to host things, such as a website, and access it from your machine.
Additionally, there is another option called the Bridged Adapter. This creates a bridge between the LAN (which the actual machine is connected to) and the virtual machine. For simplicity, it creates a bridge between the LAN and the virtual machine, enabling the virtual machine to host websites that can be accessed by LAN-connected machines.
Understanding Linux File Structure
Now you have a clear idea about why I specifically mentioned setting these options when using VirtualBox. Now that the Ubuntu environment is set up on your machine, let’s dive into the commands I learned today.
Important Commands
I learned about three main commands today. Before going into that, we need to understand the folder and file structure of Linux. Without understanding this, you won’t be able to do anything in Linux. Linux is file-based; if we need to make changes, we must go to the particular file and make those changes. Unlike graphical user interface (GUI) systems, we use the command line interface (CLI) in Linux. Understanding the Linux file and folder structure is crucial.
Linux File System Overview
To understand this clearly, let me explain with an image.
Here, the root (/) is the main folder. Under that, there is the "etc" folder, which contains configuration files. If you are configuring a DNS server for a website, all the configuration files will be under this folder.
- The boot folder contains all the files related to booting the OS. If you face any issues with booting, that is the first place you should check.
- The var folder contains all the logs of the OS. If a website is down, those details will also be found in this folder.
- The dev folder contains details about the hardware connected to the OS.
- In the home folder, each user connected to the OS has separate folders named after their usernames.
So these are the main folders you need to know. There are many others; if you are interested, please search for them as well.
Navigating the File System
- cd / → Move to root
- cd /etc → From root, move to "etc"
- cd /etc/conf → Move to the "conf" folder
- cd /etc/conf/text.txt → Move to the "text.txt" file
This path is called a file path and can be divided into two types:
- Absolute Path: The path from the root. For "text.txt", the absolute path is cd /etc/conf/text.txt.
- Relative Path: If you are in the "conf" directory, you can reach "text.txt" by simply typing cd text.txt. This is the relative path, as it is relative to the directory you are currently in.
Checking Your Current Directory
To know which directory you are currently in, use the pwd command, which means "present working directory". This command shows you where you are currently located, allowing you to decide whether to use a relative or absolute path to reach your desired destination.
Now, I have mentioned two commands, cd and pwd. The next command I need to introduce is ls, which means "list". With this command, you can see what is contained in that folder.
So these are all the things I learned today from the session. I hope you find this helpful! If you have any comments or suggestions, please share them with us. If you need more information regarding this or any other specific topic, please comment, and we will address those topics for you!
Follow this Tutorial to install Ubuntu in Windows 11