Introduction to Linux-UNIT-3
LECTURE 1
What is Linux?
Linux is a free and open-source operating system based on UNIX.
It manages computer hardware and software resources and provides services for running
applications.
Kernel: The core part that interacts directly with hardware.
Shell: Acts as an interface between user and kernel.
Utilities: Programs that perform common system tasks (e.g., ls, cp, rm).
History of Linux
Year Event
1969 UNIX developed at AT&T Bell Labs by Ken Thompson and Dennis Ritchie.
1991 Linus Torvalds created the first Linux kernel for his personal computer.
1992 Linux was released under the GNU General Public License (GPL).
Today Used in servers, desktops, Android devices, embedded systems, and supercomputers.
Features of Linux
1. Open Source
Meaning:
Linux is open-source software, meaning its source code is freely available for anyone to view,
modify, and distribute.
Explanation:
Unlike proprietary operating systems like Windows or macOS, Linux is developed
collaboratively by programmers around the world under the GNU General Public License
(GPL).
Example:
You can download the Linux kernel source code from [Link]
Developers can modify the code and create their own Linux distributions (like Ubuntu,
Fedora, or Kali Linux).
2. Multitasking
Meaning:
Linux can execute multiple processes simultaneously without slowing down or crashing.
Explanation:
You can open multiple programs — a text editor, a browser, and a terminal — and Linux
efficiently manages CPU time between them.
Example:
In a terminal, you can run:
$ gedit &
$ firefox &
$ top
Here:
gedit & and firefox & run in the background.
top shows all running processes — demonstrating multitasking.
3. Multiuser System
Meaning:
Multiple users can log in and work on the same Linux system simultaneously, without
interfering with each other’s files or processes.
Explanation:
Linux assigns unique permissions and directories for each user.
Example:
User A (student1) can log in using SSH:
ssh student1@[Link]
User B (admin) can also log in at the same time using their credentials — both use the
same system independently.
4. Portability
Linux can run on different types of hardware, from mobile phones to supercomputers.
Because it’s written in C and follows standard POSIX guidelines, it can easily be compiled for
new hardware.
Example:
Linux runs on:
o Raspberry Pi (ARM architecture)
o Desktop computers (x86)
o Android phones
o Servers and cloud systems (AWS, Google Cloud)
5. Security
Linux provides strong security through file permissions, user authentication, and encryption.
Each file and directory has permissions for the owner, group, and others (r, w, x).
Only authorized users can read, write, or execute files.
Example:
To view permissions:
$ ls -l
-rwxr--r-- 1 user user 120 [Link]
To modify permissions:
$ chmod 700 [Link]
This allows only the owner to read, write, and execute the file.
6. Stability and Performance
Linux systems are highly stable and can run for years without crashing or requiring a reboot.
It efficiently uses system resources and doesn’t slow down over time, making it ideal for servers.
Example:
Web servers like Google, Facebook, and Amazon run on Linux because it can stay
online for months or even years without failure.
You can check uptime with:
$ uptime
10:30:22 up 24 days, 5 users, load average: 0.45, 0.30, 0.25
LECTURE-2
7. Networking Support
Linux has built-in networking tools and services for system administration, file sharing, and
internet connectivity.
It supports protocols like TCP/IP, SSH, FTP, HTTP, and NFS, and provides tools for monitoring
and managing networks.
Example:
To check network connectivity:
$ ping [Link]
To view network interfaces:
$ ifconfig
To connect remotely:
$ ssh user@server_ip
8. Shell / Command-Line Interface
Linux provides a powerful command-line interface (CLI) through the shell for direct
communication with the operating system.
The shell interprets commands entered by the user and passes them to the kernel for execution.
Common shells include bash, zsh, and fish.
Example:
Commands like:
$ ls
$ pwd
$ mkdir test
$ cp file1 file2
allow users to navigate, create, copy, or remove files quickly — often faster than using a
graphical interface.
Architecture of Linux
Linux architecture is divided into several layers:
+----------------------------+
| Application Programs | ← User-level utilities (e.g., browsers,
editors)
+----------------------------+
| Shell | ← Command-line interpreter (bash, zsh)
+----------------------------+
| Kernel | ← Core of the OS (manages CPU, memory, I/O)
+----------------------------+
| Hardware (CPU, Memory) |
+----------------------------+
Components of the Kernel:
Process Management – Controls processes (creation, scheduling, termination).
Responsible for creating, scheduling, and terminating processes.
It decides which process runs on the CPU and for how long.
Also handles process states, signals, and inter-process communication (IPC).
Example: Running multiple applications (browser, text editor) at once.
Memory Management – Allocates and deallocates memory.
Manages allocation and deallocation of memory for processes.
Keeps track of which memory is used or free.
Uses virtual memory and paging to optimize RAM usage.
Example: When a program runs, the kernel assigns memory to it and reclaims it when
the program ends.
File System Management – Handles data storage and retrieval.
Controls how data is stored and accessed on disks.
Provides a unified file structure (like /home, /etc, /usr).
Supports different file systems (ext4, FAT, NTFS).
Example: Reading or writing a file using commands like cat, cp, or ls.
Device Drivers – Interface between hardware and the system.
Act as a bridge between hardware and the kernel.
Each hardware device (keyboard, printer, disk) has a driver that translates kernel
requests into device-specific actions.
Example: The printer driver enables printing from any application.
Networking – Manages communication protocols and sockets.
Manages data communication between systems over networks.
Handles protocols (like TCP/IP), sockets, and network interfaces.
Example: Sending data via ping, ssh, or browsing the internet.
Linux File System
The Linux file system is hierarchical, starting from a single root /.
File and Directory Structure
Directory Description
/ Root directory (top-level)
/bin Essential user binaries (e.g., ls, cp, mv)
/boot Boot loader files
/dev Device files
/etc Configuration files
/home Home directories for users
/lib Shared libraries
/media Mount point for removable media
/opt Optional or third-party software
/tmp Temporary files
/usr User programs, libraries, documentation
/var Variable data (logs, mail, etc.)
File Permissions
Linux uses permission bits to define who can read, write, or execute a file.
Symbol Meaning Applies to
r Read permission View file contents
w Write permission Modify file contents
x Execute permission Run the file as a program
Each file has three sets of permissions:
-rwxr-xr--
Section Meaning
rwx Owner permissions
r-x Group permissions
r-- Others permissions
Example:
chmod 755 [Link]
→ Owner: read, write, execute
→ Group: read, execute
→ Others: read, execute
Understanding rwx
Symbol Meaning Permission Type
r Read View or open the file’s contents / list directory contents
w Write Modify or delete the file / add or remove files in a directory
x Execute Run the file as a program / enter the directory
Each file or directory has three sets of permissions:
1. User (Owner)
2. Group
3. Others
Example:
-rwxr-xr--
means:
Owner: rwx (read, write, execute)
Group: r-x (read, execute)
Others: r-- (read only)
rwx Binary and Octal Values
Symbol Binary Octal (Numeric) Meaning
--- 000 0 No permission
--x 001 1 Execute only
-w- 010 2 Write only
-wx 011 3 Write + Execute
r-- 100 4 Read only
r-x 101 5 Read + Execute
rw- 110 6 Read + Write
rwx 111 7 Read + Write + Execute
Combining Permissions
You combine the three octal values for user, group, and others.
Permission rwx Format Octal Code
Full access for all rwxrwxrwx 777
Owner full, others read-only rwxr--r-- 744
Owner read/write, others read rw-r--r-- 644
Owner full, group execute, others execute rwxr-xr-x 755
Owner read/write, others no access rw------- 600
Example Commands
1. View permissions:
2. ls -l
Output:
-rw-r--r-- 1 user [Link]
3. Change permissions (using numeric code):
4. chmod 755 [Link]
→ Gives owner full rights, others read & execute.
5. Change permissions (symbolic form):
6. chmod u+x [Link] # add execute for user
chmod g-w [Link] # remove write from group
Standard File Types
Symbol Type Description
- Regular file Text, binary, data
d Directory Folder containing files
Symbol Type Description
l Link Shortcut or reference to another file
c Character device Devices like keyboard or terminal
b Block device Devices like hard drives
p Named pipe Used for interprocess communication
s Socket Used for network communication
LECTURE-3
Basic Linux Commands
File and Directory Operations
Command Description Example
ls Lists files and directories ls -l (long format)
cp Copies files or directories cp file1 file2
mv Moves or renames files mv [Link] [Link]
rm Removes files or directories rm [Link], rm -r folder/
mkdir Creates a new directory mkdir new_folder
rmdir Removes an empty directory rmdir empty_dir
pwd Prints the current working directory pwd
cd Changes directory cd /home/user
Examples
$ mkdir project
$ cd project
$ echo "Hello Linux" > [Link]
$ ls
[Link]
$ cp [Link] [Link]
$ mv [Link] [Link]
$ rm [Link]
$ pwd
/home/user/project