What is Linux?
Linux is an open-source operating system (OS) kernel created by Linus Torvalds in 1991. Unlike proprietary operating systems like Windows or macOS, Linux is based on Unix-like principles and is freely available for anyone to use, modify, and distribute. It forms the foundation of various operating systems collectively known as Linux distributions, or “distros.”
Key Features of Linux:
- Open Source: The source code is freely available and can be modified by anyone.
- Security: Linux is known for its robust security features.
- Stability and Performance: Linux systems are highly stable and can run for extended periods without crashing.
- Flexibility: Suitable for various environments, from desktops to servers and embedded systems.
- Community Support: Strong support from a large global community of developers and users.
How Distributions (Distros) Work
A Linux distribution is an OS made from a software collection that includes the Linux kernel, system libraries, and software applications. Each distro is adapted for different user needs and preferences, providing unique features, package management systems, and default configurations.
Components of a Linux Distribution:
- Linux Kernel: The core of the OS that manages hardware resources.
- GNU Tools and Libraries: Essential system utilities and libraries that work with the kernel.
- Package Manager: Software that automates the installation, upgrading, configuration, and removal of programs. Examples include APT (Debian-based), YUM/DNF (Red Hat-based), and Pacman (Arch-based).
- Desktop Environment: The graphical user interface (GUI) users interact with, such as GNOME, KDE, or XFCE.
- Applications: Pre-installed software such as web browsers, office suites, and media players.
Popular Linux Distributions:
- Ubuntu: User-friendly, based on Debian, suitable for beginners.
- Fedora: Cutting-edge features, sponsored by Red Hat, aimed at developers and system administrators.
- Debian: Known for its stability and vast software repository.
- Arch Linux: Rolling release model, minimalistic, and highly customizable.
- CentOS: Community-supported, derived from Red Hat Enterprise Linux, used in servers.
- Linux Mint: Based on Ubuntu, popular for its ease of use and pre-installed multimedia support.
Essential Knowledge for Using Linux
Basic Commands:
- Navigation:
ls
(list files), cd
(change directory), pwd
(print working directory)
- File Operations:
cp
(copy files), mv
(move/rename files), rm
(remove files)
- System Info:
uname -a
(system information), df -h
(disk space usage), top
(process monitoring)
- Package Management:
- Debian-based (APT):
sudo apt update
, sudo apt install <package>
, sudo apt upgrade
- Red Hat-based (YUM/DNF):
sudo yum install <package>
, sudo dnf update
- Arch-based (Pacman):
sudo pacman -Syu
, sudo pacman -S <package>
File Permissions:
- Understanding Permissions:
r
(read), w
(write), x
(execute)
- Changing Permissions:
chmod
(change file mode bits), chown
(change file owner)
- Example:
chmod 755 file.sh
(rwxr-xr-x), chown user:group file.sh
Shell Scripting:
- Basics: Writing and executing simple scripts with
#!/bin/bash
at the start.
- Variables and Loops: Using variables (
$VAR
), loops (for
, while
), and conditionals (if
, else
).
- Example Script:
#!/bin/bash
echo "Hello, World!"
for i in {1..5}; do
echo "Iteration $i"
done
System Administration:
- User Management:
adduser
, deluser
, usermod
- Service Management:
systemctl start <service>
, systemctl stop <service>
, systemctl enable <service>
- Networking:
ifconfig
, ip
, ping
, ssh
Understanding Kernels, Bootloaders, and GRUB