Linux
WHAT IS LINUX ?

Linux is a free and open-source operating system based on the Unix operating system. It was created by Linus Torvalds in 1991 and has since grown into a popular alternative to proprietary operating systems like Windows and macOS.

One of the key features of Linux is its open-source nature, which means that the source code for the operating system is freely available and can be modified and distributed by anyone. This has led to a large community of developers contributing to the development and improvement of Linux.

Linux is known for its stability, security, and flexibility, and is widely used in servers, supercomputers, embedded systems, and other applications. It supports a wide range of hardware architectures and comes with a variety of software tools and applications, many of which are also open source.

The Linux operating system comprises several different pieces :

  • Bootloader : The software that manages the boot process of your computer. For most users, this will simply be a splash screen that pops up and eventually goes away to boot into the operating system.
  • Kernel : This is the core of the Linux operating system, which interacts with the hardware and manages system resources such as memory, CPU, and storage. The kernel is the lowest level of the OS.
  • Init System : This is a sub-system that bootstraps the user space and is charged with controlling daemons. One of the most widely used init systems is systemd? which also happens to be one of the most controversial. It is the init system that manages the boot process, once the initial booting is handed over from the bootloader (i.e., GRUB or GRand Unified Bootloader).
  • Daemons : These are background services (printing, sound, scheduling, etc.) that either start up during boot or after you log into the desktop.
  • Shell : This is the interface between the user and the operating system, which allows the user to interact with the system by typing commands and receiving feedback.
  • Graphical Server : This is the sub-system that displays the graphics on your monitor. It is commonly referred to as the X server or just X.
  • Utilities : These are the software tools that perform specific tasks, such as managing files and directories, processing data, and communicating with other systems.
  • Desktop Environment : This is the piece that the users actually interact with. There are many desktop environments to choose from (GNOME, Cinnamon, Mate, Pantheon, Enlightenment, KDE, Xfce, etc.). Each desktop environment includes built-in applications (such as file managers, configuration tools, web browsers, and games).
  • Applications : These are the software programs that run on top of the operating system and provide specific functionality to the user, such as word processors, web browsers, and media players.

Together, these different pieces of the Linux operating system work together to provide a powerful, flexible, and customizable platform for computing.

WHY USE LINUX ?

There are many reasons why someone might choose to use Linux, including :

  • Cost : Linux is free and open-source, which means that it can be downloaded, installed, and used at no cost.
  • Security : Linux is known for its security features, which include regular updates and patches, built-in firewalls, and user permissions that help to prevent unauthorized access and malware attacks.
  • Stability : Linux is known for its stability and reliability, which means that it can run for long periods of time without crashing or needing to be rebooted.
  • Flexibility : Linux is highly customizable, which means that it can be tailored to the needs of the user, including customizing the interface, installing specific software packages, and modifying the source code.
  • Compatibility : Linux is compatible with a wide range of hardware architectures, which means that it can be used on many different types of devices, including servers, desktops, laptops, and mobile devices.
  • Support : Linux has a large and active community of developers, users, and contributors who provide support, documentation, and resources to help users learn and use Linux effectively.

Overall, Linux is a powerful and flexible operating system that provides many benefits to users, including cost savings, security, stability, and customization options.

OPEN SOURCE

Linux is also distributed under an open source license. Open source follows these key tenants :

  • The freedom to run the program, for any purpose.
  • The freedom to study how the program works, and change it to make it do what you wish.
  • The freedom to redistribute copies so you can help your neighbor.
  • The freedom to distribute copies of your modified versions to others.

These points are crucial to understanding the community that works together to create the Linux platform. Without a doubt, Linux is an operating system that is ?by the people, for the people?. These tenants are also a main factor in why many people choose Linux. It?s about freedom and freedom of use and freedom of choice.

WHAT IS A DISTRIBUTION ?

A Linux distribution, often called a distro, is a complete operating system that is based on the Linux kernel and includes a collection of software tools, utilities, applications, and a desktop environment.

Each Linux distribution is unique and tailored to meet the needs of a particular group of users or use case. Some examples of Linux distributions include :

  • Ubuntu : This is a popular Linux distribution that is based on Debian and is designed for ease of use and desktop computing.
  • Red Hat Enterprise Linux : This is a commercial Linux distribution that is designed for enterprise computing, with a focus on stability, security, and support.
  • Fedora : This is a community-driven Linux distribution that is designed for developers, with a focus on cutting-edge software and tools.
  • Debian : This is a stable and widely used Linux distribution that is known for its reliability and package management system.
  • Arch Linux : This is a lightweight and highly customizable Linux distribution that is designed for advanced users who want full control over their system.
  • CentOS : This is a community-supported Linux distribution that is based on Red Hat Enterprise Linux and is designed for servers and enterprise computing.

Each distribution has a different take on the desktop. Some opt for very modern user interfaces (such as GNOME and Elementary OS’s Pantheon), whereas others stick with a more traditional desktop environment (openSUSE uses KDE).

You can check out the top 100 distributions on the Distrowatch

WHICH DISTRIBUTION IS RIGHT FOR YOU ?

Choosing the right Linux distribution depends on your needs and preferences, as each distribution has its own strengths and weaknesses. Here are some factors to consider when choosing a Linux distribution :

  • Purpose : Determine what you will be using Linux for, whether it's personal computing, web development, server administration, or other purposes.
  • Skill Level : Consider your level of experience with Linux and your comfort level with using the command line interface.
  • Hardware : Consider the hardware requirements of the distribution, including processor speed, memory, and storage.
  • Support : Look for a distribution with good community support, documentation, and resources.
  • Desktop Environment : Consider the user interface and desktop environment of the distribution, such as GNOME, KDE, or XFCE.
  • Package Management : Consider the package management system of the distribution, including the availability of software packages and ease of installation.
  • Security : Consider the security features of the distribution, including regular updates and patches, built-in firewalls, and user permissions.

Once you have considered these factors, you can research different Linux distributions and try them out using live CDs or virtual machines. Some popular Linux distributions include Ubuntu, Fedora, Debian, and CentOS, but there are many other distributions available to choose from. Ultimately, the best Linux distribution for you will depend on your individual needs and preferences.

INSTALLING LINUX

The process of installing Linux depends on the specific distribution you choose, but here are some general steps that can guide you through the process :

  • Choose a distribution : Select the Linux distribution that best suits your needs and download the ISO image file from the distribution's website.
  • Create installation media : Burn the ISO image file to a USB drive or DVD to create installation media.
  • Boot from the installation media : Insert the installation media into your computer and boot from it. This may require changing the boot order in your BIOS settings.
  • Start the installer : Once the installation media has booted, start the installer and follow the on-screen instructions to select your language, time zone, and keyboard layout.
  • Partition your hard drive : The installer will prompt you to partition your hard drive, which involves dividing it into sections for the operating system, applications, and data.
  • Install Linux : Follow the installer's instructions to install Linux to the partition you have created. You may be asked to create a user account and set a password.
  • Complete the installation : Once the installation is complete, remove the installation media and reboot your computer.
  • Configure your system : Follow the on-screen instructions to configure your system settings, including network, display, and user preferences.
  • Install additional software : Depending on your needs, you may want to install additional software packages using your distribution's package manager.

These are general steps and the exact process may vary depending on the distribution you choose. It is important to carefully read the documentation and follow the instructions provided by the distribution to ensure a successful installation. That’s it. Once the system has completed the installation, reboot and you’re ready to go.

INSTALLING SOFTWARE ON LINUX

USING APP STORE :

Installing software on Linux is typically done through the distribution's package manager. :

  • Open the package manager : Open the package manager for your distribution. This may be called "Software Center", "Package Manager", or "Add/Remove Software".
  • Search for the software : Use the search function to find the software you want to install. You can search by name, keyword, or category.
  • Select the software : Select the software you want to install from the search results.
  • Install the software : Click the "Install" button to install the software. You may be prompted to enter your administrator password.
  • Wait for the installation to complete : The package manager will download and install the software and any required dependencies.
  • Launch the software : Once the installation is complete, you can launch the software from the application menu or by typing its name in the terminal.

Some Linux distributions may have different package managers, but the general process is similar. It is important to use the package manager to install software, as this ensures that the software is compatible with your distribution and that any security updates or bug fixes will be automatically applied.

USING COMMAND LINE INTERFACE :

You can also install software on Linux using the command line interface. Here are the general steps :

  • Open the terminal : Open the terminal application on your Linux distribution.
  • Search for the software : Use the package manager's search command to find the software you want to install. For example, to search for the "nmap" network mapper, you would type :
sudo apt search nmap

This will display a list of packages that match your search query.

  • Install the software : Use the package manager's install command to install the software. For example, to install the "nmap" network mapper, you would type :
sudo apt install nmap

The sudo command is added because you need super user privileges in order to install software. You may be prompted to enter your administrator password.

  • Wait for the installation to complete : The package manager will download and install the software and any required dependencies.

Similarly, to install the same software on a Fedora-based distribution, you would first su to the super user (literally issue the command su and enter the root password), and issue this command :

yum install wget
  • Launch the software : Once the installation is complete, you can launch the software from the terminal by typing its name.

Using the command line to install software can be faster and more efficient than using a graphical package manager, especially for experienced Linux users. However, it does require familiarity with the Linux command line interface and package management system.

File Permissions

In Linux, file permissions determine who can access and modify files on the system. There are three types of permissions : read, write, and execute. These permissions are assigned to three types of users : the file owner, the group owner, and all other users.

Read, Write and Execute

Here is a breakdown of the permissions :

  • Read Permission : Allows a user to view the contents of a file or directory.
  • Write Permission : Allows a user to modify the contents of a file or directory, including deleting or renaming it.
  • Execute Permission : Allows a user to execute a file, which means running it as a program or script.

Each file and directory on a Linux system has a set of permissions that can be viewed and modified using the ls and chmod commands, respectively.

The ls command is used to display information about files and directories. The output includes a list of files or directories, along with their permissions, ownership, and other attributes.

The chmod command is used to modify file permissions. It can be used to grant or revoke permissions for the owner, group, and other users.

The syntax for using the chmod command is as follows :

chmod [permissions] [file or directory]

The permissions are specified using a three-digit number, where each digit represents the permissions for the owner, group, and other users, respectively. The permissions are assigned using the following values :

  • 4 : Read Permission
  • 2 : Write Permission
  • 1 : Execute Permission

For example, to give the owner read and write permissions, the group read permissions, and other users no permissions, you would use the following command :

chmod 640 readme.txt

This sets the permissions for readme.txt to rw-r-----. The owner has read and write permissions, the group has read permissions, and other users have no permissions.

File permissions are an important aspect of Linux security, as they help protect sensitive data and system files from unauthorized access and modification. It is important to understand how file permissions work and to use them effectively to secure your Linux system.

File System

The Linux file system is a hierarchical directory structure that organizes files and directories on a Linux system. The file system starts at the root directory, represented by a forward slash (/), and branches out to other directories and subdirectories.

  • /bin : Contains essential system binaries (executable files).
  • /boot : Contains files needed for booting the system, such as the kernel and bootloader configuration files.
  • /dev : Contains device files, which are used to interact with hardware devices.
  • /etc : Contains system configuration files.
  • /home : Contains user home directories.
  • /lib : Contains shared library files.
  • /mnt : Contains mount points for temporary file systems, such as external hard drives or USB drives.
  • /opt : Contains optional software packages.
  • /proc : Contains information about system processes and kernel settings.
  • /root : The home directory of the root user.
  • /sbin : Contains essential system binaries for system administration tasks.
  • /tmp : Contains temporary files.
  • /usr : Contains user binaries, libraries, documentation, and source code.
  • /var : Contains variable files, such as log files and spool directories.

Understanding the Linux file system is important for navigating and managing files and directories on a Linux system. The file system is designed to be efficient and flexible, allowing users and system administrators to easily organize and access files and directories.

COMMAND LINE

The command line is a text-based interface in a Linux or Unix operating system where users can interact with the system by typing commands. It is also known as the shell or terminal.

Using the command line, users can navigate the file system, create and modify files, manage processes, install software, and perform other tasks on a Linux system. The command line provides a powerful and flexible way to interact with the system, and many advanced tasks can only be performed through the command line.

The basic syntax of a command is :

command [options] [arguments]

The command is the name of the program or function that you want to run. Options are additional settings that modify the behavior of the command, and arguments are inputs that the command requires to perform its function.

Here are some common commands that you can use in the command line :

BASIC LINUX COMMANDS :

ls - list directory content
cat - view file contents
file - determine file type
mkdir - make directory
rmdir - remove directory
cp - copy files and directories
mv - move files and directories
rm - remove files and directories
touch - create a blank file
wc - count words, lines or chars
sort - sort the content of a file
head - print first few lines
tail - prints last 10 lines( default)
pwd - print the current working directory
whoami - display the current user
history - list previous commands
locate - find files and directories
find - search file, dir or necessery data in specified location
grep - search for data in files
su - change user or superuser
sudo - temporarily superuser
chmod - modify file access rights
chown - change file ownership
chgrp - change group ownership
man - help details
zip - create and extract zip
md5sum - check for file tamper
free - free and used ram
uname - basic system info including kernel name, version, and release.
top - running and active real-time processes

UPDATE / UPGRADE :

sudo apt update -y
sudo apt upgrade -y

NETWORK COMMANDS :

ifconfig - interface configurator, gives the details of all networks
ip addr - latest and updated version of ifconfig command
traceroute - detects the delay and determines the pathway to your target
tracepath - similar to traceroute
ping - checks for the network connectivity between two nodes
netstat - provides statistical figures about different interfaces
ss - similar to netstat but more informative
dig - it is used to find query related info
nslookup - used to find dns related query
route - manipulate and shows ip routing table
host - displays the domain name for a given ip
arp - it is used to view and add content to kernel's arp table
iwconfig - it is used to configure the wireless interface and view the basic wifi details
hostname - view and set the hostname of
curl - transfer data from/to server
wget - downloading files from the internet through cli
ssh - log into a remote machine
whois - used to fetch all the info related to a website
iftop - it is used in traffic monitoring
tcpdump - captures the traffic that is passing through the network interface and displays it

SYSTEM INFO :

nbtstat -a ip - get hostname for ip
id - current username
w - logged on users
who -a - user information
last -a - last users logged on
ps -ef - process listing (top)
df -h - disk usage (free)
uname -a - kernel version/cpu info
mount - t1ounted file sjstems
getent passwd - show list of users
path~$path:/home/mypath - add to path variable
kill pid - kills process with pid
cat /etc/issue - show os info
cat /etc/'release' - show os version info
cat /proc/version - show kernel info
rpm --querj -all - installed pkgs (redhat)
rpm -ivh ) .rpm - install rpm (-e~remove)
dpkg -get-selections - installed pkgs (ubuntu)
dpkg -i '.deb - install deb (-r~remove)
pkginfo - installed pkgs (solaris)
which tscsh/csh/ksh/bash - show location of executable
chmod 750 tcsh/csh/ksh - disable shell , force bash

LEARNING RESOURCES :

For more information to help guide you through your lifetime with Linux, check out the following resources :

  • Linux.org : This website provides tutorials and documentation on all aspects of Linux, including installation, configuration, and administration.
  • Linux Command : This website provides a comprehensive guide to Linux commands and their usage.
  • Linux Journey : This website provides an interactive online course that covers the basics of Linux, from the command line to system administration.
  • Linux Academy : This website offers online courses and training in Linux and other open-source technologies, including certification courses.
  • Linux.com : Everything you need to know about Linux (news, tutorials and more)
  • Linux Documentation Project : This website provides a comprehensive collection of Linux documentation, including how-to guides, FAQs, and other resources.
  • The Linux Kernel Archives : This website provides access to the source code for the Linux kernel and other Linux-related software.
  • Howtoforge : Linux tutorials
  • Linux Knowledge Base and Tutorial : Plenty of tutorials and in-depth guides
  • Fossmint : All AWESOME Linux Applications and Tools
  • It's Foss : Become a Better Linux User
  • Udemy : Udemy is an online learning platform that offers a wide range of courses on Linux and other IT-related topics, from beginner to advanced levels.
  • edX : edX is an online learning platform that offers free courses from top universities on a variety of topics, including Linux.

Books :

    There are many great books on Linux available, ranging from beginner guides to advanced topics. Some popular titles include :

  • Linux for Beginners by Jason Cannon
  • Linux Administration Handbook by Evi Nemeth
  • Linux Bible by Christopher Negus
  • The Linux Command Line by William E. Shotts Jr
  • How Linux Works : What Every Superuser Should Know


Share :