Introduction to Linux
• What is Linux?
• Linux is an operating system kernel created by Linus Torvalds in 1991.
The kernel manages the system’s hardware and software resources,
enabling applications to run.
• Over time, the term "Linux" has come to represent complete
operating systems that include the kernel along with user interfaces
and utilities.
Some of the most popular
distributions include
•Ubuntu: User-friendly and great for beginners.
•Fedora: Known for having the latest features and
software.
•Debian: Stable and versatile, often used on servers.
•CentOS: Enterprise-level, widely used in the corporate
environment.
•Arch Linux: Lightweight and customizable, preferred by
advanced users.
Key Features of Linux
• Open Source.
• Linux is developed by a community of developers around the world
and anyone can contribute to its development.
• Multiuser and Multitasking.
• Multiple users can work on a system simultaneously, and the system
can run multiple tasks at the same time.
• Security.
• Linux is known for its strong security model, with features like file
permissions, user roles, and frequent security patches.
• Customizability.
• The system is highly customizable, allowing users to modify the
desktop environment, kernel, and almost every aspect of the system.
• Package Management.
• Software is installed and managed through package managers (like
apt for Ubuntu or yum for CentOS), which simplify the installation and
updating of software.
Applications of Linux
• Servers.
• Linux is widely used for running servers due to its reliability and
efficiency.
• Development.
• Programmers and developers prefer Linux for software development,
especially for open-source projects.
• Embedded Systems.
• Many devices like routers, smart TVs, and IoT devices run Linux-based
systems.
Open Source vs. Non-Open
Source Software
• Open Source Software (OSS) and Non-Open Source Software (often
called registered software) represent two contrasting philosophies in
software development, distribution, and usage.
• Here's a comparison between them.
• Open Source Software (OSS).
• Software whose source code is made freely available to the public.
Users can view, modify, and distribute the software according to the
terms of its license.
• Examples include Linux, Apache, GIMP, and Firefox.
• Non-Open Source Software (Registered Software).
• The software's source code is not shared with the public.
• It is typically developed by a company or an individual who maintains
full control over its usage, distribution, and modification.
• Examples include Windows, Adobe Photoshop, and Microsoft Office.
• Shell in Linux
• The shell is a command-line interface (CLI) that allows users to
interact with the operating system by typing commands.
• It acts as a bridge between the user and the kernel, interpreting the
user’s commands and passing them to the kernel for execution.
• Shells can be used for various tasks, such as running programs,
managing files, and executing scripts.
• Types of Shells
• There are several different types of shells in Linux, with varying
features and syntax.
• Bash (Bourne Again Shell).
• The most common shell, used by default in many Linux distributions.
It is an improvement over the original Bourne shell (sh) and offers
features like command history, command completion, and scripting
capabilities.
• Zsh (Z Shell): Known for its advanced features like better command-
line completion, prompts customization, and plugins support.
• Shell Features
• Command Execution.
• Users can execute commands directly by typing them into the shell.
For example 1s to list files or pwd to print the working directory.
• Scripting.
• Shells support scripting, where users can write shell scripts
(sequences of commands saved in a file) to automate tasks.
• Shell scripts are commonly used for system administration tasks.
• Pipelines and Redirection.
• Shells allow you to chain commands using pipes | redirect input and
output to/from files using > (output) and <
• Environment Variables.
• Shells allow the use of environment variables to store information,
such as the current working directory pwd user name USER and path
to executables PATH.
• Job Control.
• Allows for running, stopping, and backgrounding processes.
Commands like fg, bg, and kill help manage running processes.
• Shell Prompt and Customization
• The shell prompt is what users see when they open the terminal. It's
usually something like:
• username@hostname:~/current-directory$
• The shell prompt can be customized, showing things like the time, the
current Git branch, or even colored text.
• Kernel in Linux.
• The kernel is the core part of the Linux operating system.
• It interacts directly with the hardware of the machine and manages
the system’s resources, such as CPU, memory, and I/O devices.
• The kernel is responsible for ensuring that different applications and
processes can run smoothly without interfering with each other.
• Functions of the Kernel
• Process Management.
• The kernel handles the creation, execution, and termination of
processes.
• It manages multitasking, allowing multiple processes to run
concurrently by efficiently sharing CPU time between them.
• The kernel also handles process communication and synchronization.
• Memory Management.
• The kernel manages the system's memory, keeping track of which
parts are in use by which processes and optimizing memory
allocation.
• It uses virtual memory to ensure that each process has its own
private memory space, thus avoiding conflicts.
• Device Management.
• The kernel acts as an intermediary between software and hardware.
It uses device drivers to control and communicate with hardware
devices such as keyboards, hard drives, printers, and network cards.