0% found this document useful (0 votes)
177 views510 pages

The Ultimate Linux Bootcamp For DevOps, SRE and Cloud Engineers Udemy Course

The document outlines a comprehensive Linux bootcamp designed for DevOps, Site Reliability Engineering (SRE), and Cloud Engineers, covering essential Linux fundamentals and advanced topics. It includes sections on Linux history, features, command-line operations, user and group management, and various Linux distributions. The course emphasizes hands-on learning through lectures, demonstrations, and practice tests to equip participants with practical skills in Linux system management.

Uploaded by

pracheth sp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views510 pages

The Ultimate Linux Bootcamp For DevOps, SRE and Cloud Engineers Udemy Course

The document outlines a comprehensive Linux bootcamp designed for DevOps, Site Reliability Engineering (SRE), and Cloud Engineers, covering essential Linux fundamentals and advanced topics. It includes sections on Linux history, features, command-line operations, user and group management, and various Linux distributions. The course emphasizes hands-on learning through lectures, demonstrations, and practice tests to equip participants with practical skills in Linux system management.

Uploaded by

pracheth sp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 510

The Ultimate Linux Bootcamp for

DevOps, SRE and Cloud Engineers


(Hands-On)
DevOps Cloud Computing Site Reliability Engineering

Copyright © Thinknyx Technologies LLP


Yogesh Raheja

Copyright © Thinknyx Technologies LLP


Our Courses & Books

Copyright © Thinknyx Technologies LLP


Thinknyx Team
Yogesh Raheja

Copyright © Thinknyx Technologies LLP


Command-line User & Group File
Linux Architecture Operations Management Permissions

Package Storage Process & Service


Networking
Management Management Management

SSH Scheduling
System Monitoring

Copyright © Thinknyx Technologies LLP


Lectures

Demonstrations

Practice Tests

Copyright © Thinknyx Technologies LLP


Linux Fundamentals Setting up Linux

Command-line
Operations Text Editors

User and Group


Management Service Management

Linux Disk Management Logical Volume


Management (LVM)

Networking
Fundamentals SSH

System Management System Monitoring

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 1
Linux | Introduction to Linux

Copyright © Thinknyx Technologies LLP


Introduction to Linux

➢ Evolution of Operating Systems


➢ Linux’s Pivotal Role in Modern Computing
➢ Key Features of Linux
➢ Essential Terminologies
➢ Types of Linux Shells
➢ Linux Distributions

Copyright © Thinknyx Technologies LLP


Linux | History of Operating
Systems

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

Software

Computing devices
Operating system

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

✓ Early computing ran one program at a time

✓ Programs were manually loaded using punch cards


Early Computing
✓ Early computing output was slow
(1940s - 1950s)
✓ Development of the first operating systems

✓ Operating systems automated program loading and queue management

Copyright © Thinknyx Technologies LLP


History of Operating
Systems
✓ Spread of Computers

✓ Need for Compatibility

The Need for Compatibility ✓ Custom-Built Computers


(1960s)
✓ Device Drivers
- abstracted complexities of interacting with different hardware

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

✓ Introduction of multitasking

✓ Simultaneous program execution


The Rise of Multitasking
✓ Emergence of the Atlas Supervisor in the 1960s
(1960s)
✓ CPU usage maximization

✓ Automated program switching for continuous computing

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

✓ Virtual memory in operating systems

✓ Dynamic memory allocation for programs

Memory Management and Time-


✓ Memory protection between programs
Sharing (1960s)

✓ Multi-user support through time-sharing

✓ Emergence of Multics as a timesharing Operating System

Copyright © Thinknyx Technologies LLP


History of Operating
Systems
✓ Ken Thompson and Dennis Ritchie developed Unix in 1969 at Bell Labs

✓ Unix introduced a streamlined kernel that separated essential functions from user utilities

✓ The kernel manages system resources and facilitates communication between hardware and software
The Birth of Unix (1969)
✓ Unix's modular design allowed it to be adapted for various hardware platforms

✓ Unix's open-source code led to influential versions like AT&T's System V and BSD

✓ This innovation enabled Unix variants like HP-UX, Solaris, and AIX to thrive in industries

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

✓ Linus Torvalds released the first version of Linux in 1991

✓ Linux is a free and open-source operating system

The Rise of Linux (1991) ✓ Inspired by Unix, Linux has a modular design

✓ Global contributions have led to a wide variety of Linux distributions

✓ Linux is used in data centers and Android smartphones

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

✓ Support for diverse devices (desktops, mobile phones, etc.)

✓ Efficient multitasking with protected memory


Modern Operating Systems
✓ Process isolation for enhanced security
(21st Century)
✓ Advanced scheduling techniques for optimal performance

✓ Concurrent application execution without significant performance degradation

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

Ken Thompson Dennis Ritchie Bill Gates Paul Allen Steve Jobs Linus Torvalds

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

Early Computing (1940s The Rise of Multitasking Memory Management and Time-
The Need for Compatibility (1960s) The Birth of Unix
- 1950s) Sharing (1960s)
(1960s)
(1969)

Copyright © Thinknyx Technologies LLP


History of Operating
Systems

The Rise of Linux Modern Operating Systems


(1991)
(21st Century)

Copyright © Thinknyx Technologies LLP


Linux | Getting Started

Copyright © Thinknyx Technologies LLP


Getting Started with Linux

Copyright © Thinknyx Technologies LLP


Getting Started with Linux

Copyright © Thinknyx Technologies LLP


Getting Started with Linux
History of Linux

➢ Inception and Vision

Linus Torvalds
Andrew S. Tanenbaum
1985 Tanenbaum preferred Minix's microkernel design over 1990

Torvalds' monolithic kernel approach

Minix Linux

Copyright © Thinknyx Technologies LLP


Getting Started with Linux
History of Linux

➢ The Open-Source Movement

1992

✓ Linus Torvalds re-licensed the kernel ✓ Many Linux distributions combine the kernel with

✓ General Public License (GPL) GNU tools for various needs

✓ A Linux distro combines the Linux kernel with

software and tools


✓ The licensing enabled global developer collaboration

and contributions

Copyright © Thinknyx Technologies LLP


Getting Started with Linux
History of Linux

➢ A New Paradigm for Software Development

Late-1990s
Mid-1990s

✓ Linux distributions offered powerful tools and promoted user ✓ Corporations like IBM invested in Linux development

freedom
✓ Open-source ethos enabled innovation through modification,

sharing, and inclusivity

Copyright © Thinknyx Technologies LLP


Getting Started with Linux
History of Linux

➢ Linux Today and Its Impact • In DevOps landscape

✓ Linux serves as the backbone of the digital ecosystem

✓ Linux manages over 90% of public cloud workloads


✓ Scalability and efficiency
✓ Linux-based instances

Copyright © Thinknyx Technologies LLP


Linux | Features

Copyright © Thinknyx Technologies LLP


Linux
Features 1 2

Open Source Multiuser and Multitasking Capability

3 4

Portability Security

5 6

Command Line Interface Stability and Reliability

7 8

Community Support Development Environment

Unified File System in Linux

Copyright © Thinknyx Technologies LLP


Linux | Terminologies

Copyright © Thinknyx Technologies LLP


Linux Terminologies

The Shell or ✓ Background


Instance
Provides
Offer
Organizes
The of
unique
commandaof
tools
and
"brain" running
for
tools
programs
the andprogram
linecreating
interface
manages
Linux GUIs
packages
files (CLI)
supporting
system, built
in
in Linux on the
Linux
managing
applicationsLinux
hardware kernel
or system
andfunctions
resources
X Window
Kernelline ✓ httpd:
Created
Enables when toyou
ainteraction
Examples:
Allows users execute
typewith aFAT,
Linux
commands command
through or launch
graphical
to control an application
controls
the system
command
Distributions
Process
Services
Filesystem
Common
Acts types:
asHandles
bridge ext3,
web ext4,
between
services
hardwareXFS, Btrfs
and applications
System ✓ ftpd:
Each
Acts
Forms process
Desktop
distro
as
Different
Manages
the hasofaatransfers
anenvironments
customizesunique
intermediary
filesystems
core file like
LinuxProcess
GNOME,
to
between
cater to
Linux-based suitID
the
various (PID)
KDE,
user
use
Operating Xfce,
specific andOS,
needs
and
cases the
System Fluxbox build on
translating top of X to
commands
interface (CLI)
✓ systemd:
The PID
offer
into
Combined helps
withmanage
user-friendly
instructions
Impacts performance,
Supervises
librariesresources
forvisuals
the kernel
data
the and andto
integrity,
system
utilities
from track
and
boot or shutdown
terminate
storage
create
to processes
efficiency
Linux distros
✓ Common shells: bash, zsh

Copyright © Thinknyx Technologies LLP


Linux Terminologies

✓ The "brain" of the Linux system, managing hardware and resources


Kernel ✓ Acts as a bridge between hardware and applications
✓ Forms the core of a Linux-based OS
✓ Combined with libraries and utilities to create Linux distros

Copyright © Thinknyx Technologies LLP


Linux Terminologies

✓ Offer unique tools and packages built on the Linux kernel


✓ Examples: Ubuntu, Fedora, Red Hat
Distributions
✓ Each distro customizes Linux to suit specific needs

Copyright © Thinknyx Technologies LLP


Linux Terminologies

✓ Instance of a running program


✓ Created when you execute a command or launch an application
Process
✓ Each process has a unique Process ID (PID)
✓ The PID helps manage resources and track or terminate processes

Copyright © Thinknyx Technologies LLP


Linux Terminologies

✓ Background programs supporting applications or system functions


✓ httpd: Handles web services
Services
✓ ftpd: Manages file transfers
✓ systemd: Supervises the system from boot to shutdown

Copyright © Thinknyx Technologies LLP


Linux Terminologies

✓ Organizes and manages files in Linux


✓ Common types: ext3, ext4, FAT, XFS, Btrfs
Filesystem
✓ Different filesystems cater to various use cases
✓ Impacts performance, data integrity, and storage efficiency

Copyright © Thinknyx Technologies LLP


Linux Terminologies

✓ Provides tools for creating GUIs


X Window ✓ Enables interaction with Linux through graphical controls

System ✓ Desktop environments like GNOME, KDE, Xfce, and Fluxbox build on top of X to
offer user-friendly visuals

Copyright © Thinknyx Technologies LLP


Linux Terminologies

The Shell or ✓ The command line interface (CLI) in Linux


✓ Allows users to type commands to control the system
Command Line
✓ Acts as an intermediary between the user and the OS, translating commands
Interface (CLI) into instructions for the kernel
✓ Common shells: bash, zsh

Copyright © Thinknyx Technologies LLP


Linux | Types of Shells

Copyright © Thinknyx Technologies LLP


Types of Shells

Shell is a Command-line interface

It's a bridge between User and Operating System

Linux Commands

Shell Kernel

User

Copyright © Thinknyx Technologies LLP


Types of
Shells
01 Bourne Shell (sh)

02 Bourne Again Shell (Bash)


Commonly Used
✓ Combines
One of the
Enhanced
Inspired
Extended earliest
version
byshell
features ofshells
Bourne
C programming
withoffeatures
Bourne Shell
language
from
and CBash
Shells
syntax
and Korn Shells
Shells in Linux 03 C Shell (csh) ✓ Ideal
Designed
Default
Features:
Highlyforonfor
flexiblebasic
many
heavy-duty
aliasing
with scripting
Linux
and and
customizable
scripting
history andcommand-line
distributions
mechanism
prompts
interactive
for tasks
anduse
efficient
powerful auto-
✓ Includes
Simple
commandand
Features:
completion efficient
command
built-in
reuse for running
history,
functions forjob commands
control,
advanced advanced scripting
scripting

✓ Popular among advanced users


04
Korn Shell (ksh)

05
Z Shell (zsh)

Copyright © Thinknyx Technologies LLP


Linux | Types of Distributions

Copyright © Thinknyx Technologies LLP


Linux Distribution
✓ A Linux distribution (distro) is a Linux-based operating system
✓ Combines the Linux kernel with tools, libraries, and utilities
✓ Each distro has its own package management and repository
✓ Some distros offer unique desktop environments
✓ Designed for different users: beginners, administrators, or enterprises

Now hundreds of Linux


distributions ➢ Three foundational families

Copyright © Thinknyx Technologies LLP


Types of Distributions
Slackware: The Old-School Stability

✓ One of the oldest Linux distributions

✓ Focuses on simplicity and stability

✓ Designed for advanced users and administrators

✓ Minimalist, no-frills experience

✓ Not widely adopted but has a dedicated following

✓ Follows the "Keep It Simple, Stupid" (KISS) philosophy

✓ Popular for servers and custom configurations

Copyright © Thinknyx Technologies LLP


Types of Distributions
Debian: The Universal Operating System

✓ Foundation for Popular Distros like Ubuntu

✓ Renowned Stability and Security

✓ Ideal for Servers and Critical Systems

✓ Developer and Administrator Friendly

✓ Robust Dependency Management

Copyright © Thinknyx Technologies LLP


Types of Distributions
Red Hat Linux: The Enterprise Pioneer

✓ Discontinued in 2003, but paved the way for enterprise Linux

✓ Introduced the RPM (Red Hat Package Manager) system

✓ Legacy continues with Red Hat Enterprise Linux (RHEL)

✓ Widely adopted in businesses for reliability and professional support

✓ Set the standard for commercial Linux support

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ Ubuntu: The Beginner-Friendly

✓ Built on Debian, known for user-friendliness

✓ Ideal for beginners, students, and developers

✓ Offers stability and a vast software repository

✓ Excellent for cloud computing, AI, and machine learning

✓ Strong community support and regular updates

✓ One of the most popular Linux distros globally

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ Fedora: The Cutting-Edge Innovator

✓ Sponsored by Red Hat, focuses on cutting-edge technologies

✓ Ideal for developers and sysadmins seeking new features

✓ Popular in tech communities for containerization and virtualization

✓ Strong support for tools like Podman and KVM

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ CentOS: The Enterprise Workhorse

✓ Based on RHEL, stable without commercial support

✓ A server staple until its End-of-Life in 2024

✓ Rocky Linux is the successor, offering a community-driven, production-ready alternative

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ Arch Linux: The DIY Enthusiast's Choice

✓ Customizable and minimalist for advanced users

✓ Rolling-release for latest software

✓ Ideal for power users who configure from scratch

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ Linux Mint: The Elegant Desktop

✓ Built on Ubuntu user-friendly interface

✓ Ideal for casual users and home setups

✓ Features Cinnamon desktop and multimedia support

✓ Stable for daily tasks

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ openSUSE: The Swiss Army Knife

✓ Based on SUSE Linux, known for flexibility

✓ Popular among developers and system admins

✓ Two editions: Leap for stability, Tumbleweed for latest software

✓ Suited for both long-term and cutting-edge users

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions

➢ Manjaro: The User-Friendly Arch

✓ Based on Arch Linux, offers easier installation

✓ Ideal for gamers, developers, and those seeking a rolling-release model

✓ Access to Arch User Repository (AUR)

✓ Simplified system management tools for tech enthusiasts

Copyright © Thinknyx Technologies LLP


Types of Distributions
Popular distributions
Ubuntu: The Beginner-Friendly

Fedora: The Cutting-Edge Innovator


• Its own flavor and purpose, making Linux
flexible for a wide range of use cases, CentOS: The Enterprise Workhorse
from servers and desktops to specialized
Arch Linux: The DIY Enthusiast's Choice
systems
Linux Mint: The Elegant Desktop

openSUSE: The Swiss Army Knife

Manjaro: The User-Friendly Arch

Copyright © Thinknyx Technologies LLP


Summary

❖ History of Operating Systems: Brief overview and evolution

❖ Introduction to Linux: Unique features and core terminologies


❖ Types of Shells: Exploring the command-line interface

❖ Linux Distributions: Diversity and strengths of popular distros

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 2
Linux | Inside Linux (Architecture, Directory Structure & Booting
Process)

Copyright © Thinknyx Technologies LLP


Inside Linux

➢ Architecture of Linux
➢ Directory Structure
➢ Important Configuration files
➢ Bootup process

Copyright © Thinknyx Technologies LLP


Linux | Architecture

Copyright © Thinknyx Technologies LLP


Linux Architecture
Application 1 Application 2 … Application n

Kernel core & subsystems Generic Drivers

Generic Architecture Code

Architecture Specific Code

Bootstrap Memory Threads Timers

IRQs Syscalls Platform Drivers

Platform Drivers machine … machine

Hardware

Copyright © Thinknyx Technologies LLP


Linux Architecture
Applications

Web browsers Media players Databases

Shell CLI

Kernel

Hardware

Hard Drive RAM CPU Motherboard Network Interfaces

Copyright © Thinknyx Technologies LLP


Linux Architecture
Application 1 Application 2 … Application n

Kernel core & subsystems Generic Drivers

Generic Architecture Code

Architecture Specific Code

Bootstrap Memory Threads Timers


Kernel space
IRQs Syscalls Platform Drivers

Platform Drivers machine … machine

Hardware

Copyright © Thinknyx Technologies LLP


Linux Architecture
Applications

Microsoft Word

Shell

Kernel

Hardware

Hard Drive RAM CPU Motherboard Network Interfaces

Copyright © Thinknyx Technologies LLP


Linux Architecture

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt proc root

run sbin srv sys tmp usr var

Copyright © Thinknyx Technologies LLP


Linux | Directory Structure

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin

▪ Essential user command binaries

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot

▪ Files required for booting the system

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev

▪ Device files

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc

▪ Configuration files for the system

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home

▪ Home directory for regular users

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib

▪ Essential shared libraries and kernel modules

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media

▪ Mount point for removable media

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt

▪ Temporary mount point for mounting filesystems

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt

▪ Add-on software packages

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt proc

▪ Information about running processes and the kernel

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

▪ Home directory for the root user

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run

▪ Directory is used for information about the current state of


the system

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run sbin

▪ System binaries

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run sbin srv

▪ Data for services provided by the system

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run sbin srv sys

▪ Virtual filesystem and mount point for sysfs

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run sbin srv sys tmp

▪ Temporary directory

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run sbin srv sys tmp usr

▪ Directory contains user programs and data

Copyright © Thinknyx Technologies LLP


Linux Directory Structure
/

bin boot dev etc home lib media mnt opt root
proc

run sbin srv sys tmp usr var

▪ Directory contains variable data files

Copyright © Thinknyx Technologies LLP


Linux | Important Configuration Files

Copyright © Thinknyx Technologies LLP


Important Configuration
Files
Configuration folders Description
/etc/fstab All mounted filesystems can be found here and new can be
added.
/etc/resolv.conf To add DNS server entry here for resolving your hostname with
it.
/etc/ssh/sshd_config For enabling remote access via SSH port 22

/etc/passwd Contains user account details, such as usernames, user IDs, and
the default shell assigned to each user.
/etc/group Stores group information.

Copyright © Thinknyx Technologies LLP


Important Configuration
Files
Configuration folders Description
/etc/nsswitch.conf The Name Service Switch (NSS) configuration file determines
the sources from which to obtain name-service information in
a range of categories and in what order.

/etc/init.d Contains scripts linked to run-level directories.

/etc/hosts Maps IP addresses to hostnames for local/ private networks.

/etc/hosts.allow Lists host computers that are allowed to use certain TCP/IP
services from the local computer.
/etc/hosts.deny Lists host computers that are not allowed to use certain TCP/IP
services from the local computer (doesn't exist by default).

Copyright © Thinknyx Technologies LLP


Linux | Bootup Process

Copyright © Thinknyx Technologies LLP


Bootup Process
➢ Generic Booting Process

POST MBR/GPT GRUB2/GRUB/LI


BIOS/UEFI LO
Power ON Choose a Boot Device
Operating system's initialization Initializes/Detected Devices
• /boot/grub2/ on BIOS or /boot/efi/EFI/ on

UEFI systems

• /etc/default/grub
• /etc/grub.d/

initramfs
Device loads or
systemd
drivers initrd
Device drivers are loaded Kernel Initialization
Run Startup Scripts Run/.target files
systemd is the first Linux process
Users can login now
default.target is initiated

multi-user.target

Copyright © Thinknyx Technologies LLP


Bootup Process
➢ Generic Booting Process

POST MBR/GPT GRUB2/GRUB/LI


BIOS/UEFI LO
Power ON Operating system's initialization Detect Devices Choose a Boot Device
• /boot/grub2/ on BIOS or /boot/efi/EFI/ on
UEFI systems

• /etc/default/grub

• /etc/grub.d/

Runlevel Target
Run level 0 poweroff.target
Run level 1 rescue.target Device
initramfs
systemd Initialization and or
Run level 3 multi-user.target Configuration initrd
Run level 5 graphical.target Kernel Initialization
Run/.target files systemd is the first Linux process Device drivers are loaded
Run level 6 reboot.target initiated

Copyright © Thinknyx Technologies LLP


Bootup Process
➢ Generic Booting Process

POST MBR/GPT GRUB2/GRUB/LI


BIOS/UEFI LO
Power ON Operating system's initialization Detect Devices Choose a Boot Device
• /boot/grub2/ on BIOS or /boot/efi/EFI/ on
UEFI systems

• /etc/default/grub

• /etc/grub.d/

Device initramfs
systemd Initialization and or
Configuration initrd
Kernel Initialization
Run Startup Scripts Run/.target files systemd is the first Linux process Device drivers are loaded
Users can login now initiated
default.target

multi-user.target

Copyright © Thinknyx Technologies LLP


Summary

❖ Linux Architecture: Core components and their interactions


❖ Directory Structure: Organization and purpose of key directories
❖ Boot Process: Steps of how Linux boots up

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 3
Linux | Setting up Linux

Copyright © Thinknyx Technologies LLP


Setting up
Linux

Copyright © Thinknyx Technologies LLP


Linux | Setting up Linux in Diverse
Environments

Copyright © Thinknyx Technologies LLP


Setting up Linux in Diverse
Environments

Virtual machines Cloud instances Containers

Ubuntu RHEL 9

Debian RPM

Copyright © Thinknyx Technologies LLP


Setting up Linux in Diverse
Environments
➢ Setting Up Linux on Oracle VirtualBox with an Ubuntu Image file

Copyright © Thinknyx Technologies LLP


Setting up Linux in Diverse
Environments
➢ Setting Up Linux on Oracle VirtualBox with Vagrant

Copyright © Thinknyx Technologies LLP


Setting up Linux in Diverse
Environments
➢ Creating a Virtual Machine on the Cloud

Copyright © Thinknyx Technologies LLP


Setting up Linux in Diverse
Environments
➢ Quick Start with Play with Docker

Copyright © Thinknyx Technologies LLP


Demonstration | Getting started with Linux on VirtualBox

Copyright © Thinknyx Technologies LLP


Getting started with Linux on
VirtualBox
➢ Introduction to Virtualization

APP APP APP

Guest Guest Guest


OS 1 OS 2 OS 3

Oracle VirtualBox
Hypervisor

Physical Host OS

Hardware

Copyright © Thinknyx Technologies LLP


Getting started with Linux on
VirtualBox
➢ Introduction to Virtualization

Copyright © Thinknyx Technologies LLP


Getting started with Linux on
VirtualBox
➢ Features of Oracle Virtual BOX

✓ Snapshot capabilities
✓ Flexible networking options
✓ Support for various guest operating systems

❑ List of Supported Host OS for VirtualBox


https://www.virtualbox.org/manual/ch01.html#hostossupport

❑ List of Supported Guest OS for VirtualBox


https://www.virtualbox.org/manual/ch03.html#guestossupport

Copyright © Thinknyx Technologies LLP


Getting started with Linux on
VirtualBox
➢ Introduction to Virtualization

APP APP APP

Guest Guest Guest


OS 1 OS 1 OS 1

Hypervisor

Physical Host OS

Hardware

Copyright © Thinknyx Technologies LLP


Getting started with Linux on
VirtualBox
➢ Introduction to Virtualization

APP APP APP

Guest Guest Guest


OS 1 OS 1 OS 1

Oracle VirtualBox

Physical Host OS

Hardware

Copyright © Thinknyx Technologies LLP


Demonstration | Accessing Linux Machine via Putty

Copyright © Thinknyx Technologies LLP


Getting started with Linux on
VirtualBox
➢ Accessing a Linux Machine via PuTTY

PuTTY ✓ Free open-source SSH client

Copyright © Thinknyx Technologies LLP


Demonstration | Getting started with Linux on Vagrant

Copyright © Thinknyx Technologies LLP


Demonstration | Getting started with Linux on Cloud

Copyright © Thinknyx Technologies LLP


Demonstration | Getting started with Linux on Container

Copyright © Thinknyx Technologies LLP


Summary

❖ Traditional VM Setup:
Oracle VirtualBox with Ubuntu ISO
Download, installation, and configuration
❖ Automated Setup with Vagrant:
Vagrant and Oracle VirtualBox
❖ Cloud-Based Environment:
Ubuntu instance on AWS
❖ Quick Container Setup:
Play with Docker

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 4
Linux | Introduction to Essential Linux
Commands

Copyright © Thinknyx Technologies LLP


Essential Linux Commands

➢ Importance of Terminal
➢ Work with Directories, Files and File Contents

Copyright © Thinknyx Technologies LLP


Linux | Getting Started with
Terminal

Copyright © Thinknyx Technologies LLP


Getting Started with
Terminal
Graphical user interface (GUI)
Command-line interface (CLI)

✓ Visual and Intuitive Navigation ✓ Powerful Text-Based Approach


✓ Beginner-Friendly ✓ Speed and Precision
✓ Point-and-Click Interface ✓ Greater Control
✓ Preferred by advanced users and
system administrators

Copyright © Thinknyx Technologies LLP


Getting Started with
Terminal
➢ Basic Elements of a Shell Command

✓ The shell is a program that interprets user commands


✓ Commands are names of programs or scripts installed on the system
✓ Each command may include options and arguments

Copyright © Thinknyx Technologies LLP


Getting Started with
Terminal
➢ Basic Elements of a Shell Command

Syntax:
Command [Options] [Arguments]

Command Description

ls Lists files and directories in the current directory

ls -l Lists files and directories in a detailed (long) format in


the current directory
ls –l /dev Lists files and directories in the specified directory (/dev)
with detailed information

Copyright © Thinknyx Technologies LLP


Getting Started with
Terminal
➢ Basic Commands

Command Description Syntax Usage


echo Prints the string(s) to standard echo <string(s)> echo "Hello, Linux!"
output
uname Prints the Systems Information uname [options] uname -a

whoami Prints the username associated with whoami whoami


the current effective user ID
who Prints information about users who who who
are currently logged in
uptime Tells how long the system has been uptime uptime
running
date Prints or sets the system date and date date
time

Copyright © Thinknyx Technologies LLP


Linux | Working with Terminal
Utilities

Copyright © Thinknyx Technologies LLP


Working with Terminal Utilities
➢ Basic Commands

Command Description Syntax Usage


clear Clears the terminal screen clear clear

history Lists previously executed commands history history

man System's manual pager man <command> man clear

whatis Displays one-line manual page whatis <command> whatis clear


descriptions
whereis Locates the binary, source, and whereis <command> whereis clear
manual page files for a command

which Locates the path of binary, source file which <command> which ls
for a command

Copyright © Thinknyx Technologies LLP


Linux | Working with Directories

Copyright © Thinknyx Technologies LLP


Working with Directories
➢ Basic Commands

Command Description Syntax Usage


pwd Prints the full filename of the current pwd pwd
working directory
cd Changes directory cd <directory> cd /tmp

ls List information about the FILEs of ls ls


the current directory by default

mkdir Makes/Creates directory mkdir <directory> mkdir thinknyx

rmdir Removes empty directories rmdir <directory> rmdir thinknyx

Copyright © Thinknyx Technologies LLP


Working with Directories
➢ Understanding Absolute and Relative Paths

Absolute and Relative Paths:

✓ Two ways to locate files and directories


✓ Simplify system navigation

Copyright © Thinknyx Technologies LLP


Working with Directories
➢ Understanding Absolute and Relative Paths

Absolute Paths:

✓ Starts from the root directory (/)


✓ Provides the full path to a file or folder
✓ Exact location, independent of the current directory
✓ Use cd to navigate

usr

bin

Copyright © Thinknyx Technologies LLP


Working with Directories
➢ Understanding Absolute and Relative Paths

Relative Paths:

✓ Starts from the current directory


. Current directory
✓ Doesn’t begin with (/)
.. Parent directory
/home/user/documents Current directory
~ Home directory
/home/user Parent directory

Deeper directory /home/user/documents/work

/home/user

Copyright © Thinknyx Technologies LLP


Working with Directories
➢ Understanding Absolute and Relative Paths

When to Use Which?

▪ Relative Path: Quick navigation between nearby directories

/home/user/documents to /home/user/projects

▪ Absolute Path: Reliable for deeper or fixed locations

/usr/bin

Copyright © Thinknyx Technologies LLP


Working with Directories

Character Type
d Directory
- Regular file
l Symbolic links
b Block devices
c Character devices
p Named pipes(FIFOs)
s Sockets

Copyright © Thinknyx Technologies LLP


Linux | Working with Files

Copyright © Thinknyx Technologies LLP


Working with Files
➢ Basic Commands

Command Description Syntax Usage


touch Creates an empty file; touch <filename> touch thinknyx.txt

file Determines file type file <filename> file thinknyx.txt

cp Copies files and directories cp <src_filename> cp thinknyx.txt test.txt


<dest_filename>
mv Moves or renames files mv <src_filename> mv test.txt result.txt
<dest_filename>
rm Removes files or directories rm <filename> rm result.txt

Copyright © Thinknyx Technologies LLP


Linux | Working with File Contents

Copyright © Thinknyx Technologies LLP


Working with File Contents
➢ Basic Commands

Command Description Syntax Usage


cat Concatenates files and prints on the cat <file1> <file2> cat file1.txt file2.txt
standard output
tac Concatenates files and prints the tac <file1> <file2> tac file1.txt file2.txt
contents on the standard output in
reverse order
head Prints the first 10 lines of the file to head <filename> head file1.txt
standard output by default
tail Prints the last 10 lines of the file to tail <filename> tail file1.txt
standard output by default
more Prints file content page-by-page more <filename> more file1.txt

less Prints file content page-by-page in less <filename> less file1.txt


reverse

Copyright © Thinknyx Technologies LLP


Summary

❖ Foundational Shell Commands: echo, who, clear, history


❖ How to Work With: Directories, files, and file contents

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 5
Linux | More Essential Linux Commands

Copyright © Thinknyx Technologies LLP


Essential Linux Commands

➢ Focus on filter, utility, archival, and compression commands


➢ Powerful tools to manage and process data efficiently
➢ Enhance productivity and streamline tasks

Copyright © Thinknyx Technologies LLP


Linux | Filter Commands-Part1

Copyright © Thinknyx Technologies LLP


Filter Commands Part-1
➢ Basic Commands

Command Description Syntax Usage


grep Searches for patterns in files using grep <pattern> <filename> grep "hello" thinknyx.txt
regular expressions
egrep Similar to grep, but supports egrep <pattern> <filename> egrep "^[A-Z]" thinknyx.txt
extended regular expressions
wc Counts the number of lines, words, wc <filename> wc thinknyx.txt
and characters in a file
pipe Passes output from one command as command1 | command2 grep -i "developer" details.txt |
input to another wc -l
comm Compares two sorted files and comm <file1> <file2> comm file1.txt file2.txt
outputs their differences and
common lines
find Searches for files and directories find [path] [expression] find /etc -name "nsswitch.conf"
based on specified criteria

Copyright © Thinknyx Technologies LLP


Filter Commands Part-1
➢ grep: (global regular expression print)

✓ search for patterns in text files and display the lines that contain those patterns

Syntax:
grep <pattern> <filename>

Copyright © Thinknyx Technologies LLP


Linux | Filter Commands-Part2

Copyright © Thinknyx Technologies LLP


Filter Commands-Part2
➢ Basic Commands
Command Description Syntax Usage
sort Sorts lines of text from input or a file sort <filename> sort thinknyx.txt
in a specified order
uniq Removes duplicate lines from sorted uniq <filename> uniq thinknyx.txt
input
nl Numbers the lines of a file or input nl <filename> nl thinknyx.txt

cut Prints selected parts of lines from cut [options] <filename> cut -d ',' -f 1,3 file.csv
each file to standard output
tr Translates or replaces characters in tr set1 [set2] cat employees.txt | tr ',' '\t'
input
column Formats input into a well-aligned column [options] <filename> column –t employees.txt
table
pr Converts text files for printing pr [options] <filename> pr -t -2 employees.txt

tee Reads from standard input and tee <filename> pr -t -2 employees.txt | tee
writes to standard output and files formatted_employees.txt

Copyright © Thinknyx Technologies LLP


Linux | Miscellaneous Utility
Commands

Copyright © Thinknyx Technologies LLP


Miscellaneous Utility
Commands
➢ Basic Commands

Command Description Syntax Usage


date Used to display or set the system date date
date and time
sleep Pauses execution for a specified time sleep <duration> sleep 5

time Measures the time taken by a time <command> time ls


command to execute
timeout Terminates a running command if it timeout <duration> timeout 3 ls
exceeds a specified time limit <command>

Copyright © Thinknyx Technologies LLP


Linux | Compressing and Archiving
Commands

Copyright © Thinknyx Technologies LLP


Compressing and Archiving
Commands
➢ Compression and Archiving

Compression Archiving
Reduces file size to save space and Combines multiple files into one
speed up transfers without reducing size
Common Compression Tools: zip, gzip Common Archiving Tool: tar , zip

✓ tar and gzip: Creates .tar.gz files for both archiving and compression

Copyright © Thinknyx Technologies LLP


Compressing and Archiving
Commands
➢ zip vs gzip

zip gzip
Common on Windows, supports cross- Standard on Unix, Linux, and macOS
platform sharing systems
Compresses both files and directories Compresses individual files only
into a .zip file

➢ tar and gzip

✓ Creates .tar.gz archives for directories and files


✓ Preserves file permissions, metadata, and directory structures
✓ Linux backups and managing large file sets efficiently

Copyright © Thinknyx Technologies LLP


Compressing and Archiving
Commands

Copyright © Thinknyx Technologies LLP


Summary

❖ Filter Commands: grep, find, sort, uniq


❖ Utility Commands: date, sleep
❖ Archival & Compression Commands: zip, gzip, tar

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 6
Linux | Text Editors and Advanced Commands

Copyright © Thinknyx Technologies LLP


Text Editors and Advanced
Commands
➢ Nano and Vi editors
➢ Sed and Awk for advanced text processing

Copyright © Thinknyx Technologies LLP


Linux | Text Editors

Copyright © Thinknyx Technologies LLP


Text Editors
✓ Text editors are crucial for editing files directly in the terminal
✓ Two popular text editors: Nano and Vi

➢ Nano: Beginner-friendly and straightforward


➢ Vi: Advanced features for power users

Copyright © Thinknyx Technologies LLP


Text Editors
➢ Nano Editor

✓ Lightweight and easy-to-use text editor


✓ Ideal for quick edits and commonly used by beginners
✓ Open a file by using: nano filename.txt

Action Shortcut

Save a file CTRL + O

Exit Nano CTRL + X

Search for text CTRL + W

Cut a line CTRL + K

Paste a line CTRL + U

Copyright © Thinknyx Technologies LLP


Text Editors
➢ Vi Editor

✓ Widely used by advanced Linux users for efficient text editing


✓ Vi stands for Visual Editor
✓ Vim (Vi Improved) is the enhanced version of vi, adding more features, flexibility, and functionality
✓ Ideal for editing, navigating, and manipulating large amounts of text

Mode Description

Normal Mode Or Command mode Default mode for navigation and commands

Insert Mode For adding or editing text

Ex-Command Mode or Last line mode For executing operations like saving, quitting & searching

Copyright © Thinknyx Technologies LLP


Text Editors
/pattern Searches forward for the pattern from cursor position

?pattern Searches backward for pattern from cursor position

:%s/pattern/replacement/g Replace all occurrences of 'pattern' with 'replacement' in the file

:%s/pattern/replacement/gc Replace all occurrences of 'pattern' with confirmation before each


change

Copyright © Thinknyx Technologies LLP


Text Editors
➢ Advanced Vim Features

Action Command Action Command


Delete a line dd Copy yy

Delete 3 lines 3dd Paste below cursor p

Delete character at x Paste above cursor P


cursor
Undo changes u Append to end of line Shift + A

Redo changes CTRL + R

Copyright © Thinknyx Technologies LLP


Text Editors

Command Functionality Timestamp Behavior

:wq Saves changes and exits the editor Always updates the timestamp to current time

:x Saves changes and exits, but only updates the Updates timestamp only if changes were made
timestamp if changes were made

Copyright © Thinknyx Technologies LLP


Linux | Advanced
Commands

Copyright © Thinknyx Technologies LLP


Advanced
Commands
➢ Commands

Command Description Syntax Usage


sed Stream editor for filtering and sed [options] 'script' filename sed 's/World/Linux/'
transforming text thinknyx.txt
awk Pattern scanning and processing awk [options] 'pattern awk '/ERROR/ {print}'
language {action}' filename samplelog.txt

Copyright © Thinknyx Technologies LLP


Advanced
Commands

Copyright © Thinknyx Technologies LLP


Advanced
Commands

Copyright © Thinknyx Technologies LLP


Summary

❖ Nano and Vi editors: Text editing


❖ Sed and Awk: Advanced text processing

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 7
Linux | User & Group Management

Copyright © Thinknyx Technologies LLP


User & Group Management

➢ Introduction to users
➢ Managing users and groups

Copyright © Thinknyx Technologies LLP


Linux | Introduction to
Users

Copyright © Thinknyx Technologies LLP


Introduction to Users
✓ Users are the backbone of any Linux system

Copyright © Thinknyx Technologies LLP


Introduction to Users

Unique user id (UID)


▪ Linux automatically places them in a
At least one group group with the same name as the
New user
username
➢ Two primary types of users in Linux Primary group
✓ Root User
✓ Regular Users

Copyright © Thinknyx Technologies LLP


Introduction to Users
➢ Key Commands Overview

✓ id : Displays the current user’s UID, GID, and groups


✓ su : Switches the current user to another user, commonly the root user
✓ sudo : Allows a user to run commands with root privileges temporarily

Copyright © Thinknyx Technologies LLP


Linux | User Management

Copyright © Thinknyx Technologies LLP


User Management
File Description

/etc/passwd Contains user account details like username, UID, and home directory

/etc/shadow Stores hashed passwords and password-related settings, accessible


only by root
/etc/skel Contains default files and directories copied to a new user's home
directory
/etc/sudoers This file is a sensitive file, as it determines who can gain root access

Copyright © Thinknyx Technologies LLP


User Management
UID Range Description

0 Superuser (root) account

1-200 System accounts for specific processes

201-999 Unprivileged system processes

1000+ Regular users

Copyright © Thinknyx Technologies LLP


User Management

Command Description Syntax Usage


adduser Creates a new user sudo adduser <username> sudo adduser alex

passwd Change user passwords updating sudo passwd [options] sudo passwd alex
password aging policies & unlocking [username]
accounts
usermod Modifies an existing user sudo usermod <options> sudo usermod -d
<username> /home/directory alex
deluser Deletes a user sudo deluser <username> sudo deluser alex

Copyright © Thinknyx Technologies LLP


Linux | Group Management

Copyright © Thinknyx Technologies LLP


Group
Management
➢ Core concepts involved in group management
✓ addgroup : Creates a new group
✓ groupmod : Modifies existing groups
✓ /etc/group : Lists all groups on the system

Copyright © Thinknyx Technologies LLP


Demonstration | User & Group Management

Copyright © Thinknyx Technologies LLP


Group
Management
➢ Core concepts involved in group management

prod_user dev_user

Group : programmer

Copyright © Thinknyx Technologies LLP


Group
Management
➢ Core concepts involved in group management

✓ Create two users : prod_user and dev_user


✓ Create a group : programmer
✓ Add prod_user to the programmer group

Copyright © Thinknyx Technologies LLP


Demonstration | su VS su - Commands

Copyright © Thinknyx Technologies LLP


su VS su -

Command When to Use

su <username> Quick access to another user


Retains the current environment
No need for a full user session
su - <username> Loads the user's full environment
Acts like a fresh login
Preferred in production for a clean session

Copyright © Thinknyx Technologies LLP


su VS su -
➢ Quick Rule:

✓ Use su - <username> for a full login shell


✓ Use su <username> for quick user switching

Copyright © Thinknyx Technologies LLP


Summary

❖ User Concepts:
Commands: id, su, sudo, and root for user management

❖ User Management:
Key Files:
/etc/passwd: Stores user details
/etc/shadow: Manages encrypted passwords
/etc/skel: Default home directory templates

Copyright © Thinknyx Technologies LLP


Summary

❖ Commands:
adduser: Create users
usermod: Modify user details
passwd: Change user passwords
deluser: Delete users

❖ Group Management:
Key File:
/etc/group

Copyright © Thinknyx Technologies LLP


Summary

❖ Commands:
addgroup: Create new groups
groupmod: Modify existing groups

❖ Key Focus:
Managing permissions
Ensuring system security

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 8
Linux | File Permissions

Copyright © Thinknyx Technologies LLP


File Permissions

➢ File Ownership covering both Octal Mode and Symbolic Mode


➢ Managing Special Permissions

Copyright © Thinknyx Technologies LLP


Linux | File Ownership

Copyright © Thinknyx Technologies LLP


File Ownership
Link count Group

File type

Permissions Owner File size Last modification time File name

Copyright © Thinknyx Technologies LLP


File Ownership

File size Last modification time File name

Copyright © Thinknyx Technologies LLP


File Ownership

File size

Copyright © Thinknyx Technologies LLP


File Ownership

Permissions

Copyright © Thinknyx Technologies LLP


File Ownership
Group
➢ File permissions
✓ User : Owner of the file
✓ Group : Set of users
✓ Others : Everyone else

User Others

Copyright © Thinknyx Technologies LLP


File Ownership
➢ File permissions Write

✓ User : Owner of the file


✓ Group : Set of users
✓ Others : Everyone else

Read
Execute

Copyright © Thinknyx Technologies LLP


File Ownership
➢ File permission management commands

Command Description Syntax Usage


chmod Changes file mode bits chmod [options] <mode> chmod u+rx thinknyx.txt
<file>
chown Changes file owner and group chown [options] chown alex:developers filename
<owner[:group]> <file>
chgrp Changes group ownership chgrp [options] <group> <file> chgrp developers thinknyx.txt

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Different ways to use chmod

❑ Symbolic and Octal or Numeric Method

Symbolic Method

Permission groups
u user
g group
o others
a all

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Different ways to use chmod

❑ Symbolic and Octal or Numeric Method

Symbolic Method

Permission types
r read permission
w write permission
x execute permission

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Different ways to use chmod

❑ Symbolic and Octal or Numeric Method

Symbolic Method

Operators
+ add permission
- remove permission
= set permission explicitly, replacing others

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Different ways to use chmod

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Different ways to use chmod

❑ Symbolic and Octal or Numeric Method

Octal Method

Permission
4 read permission (r)
2 write permission (w)
1 execute permission (x)

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Different ways to use chmod

❑ Symbolic and Octal or Numeric Method

Octal Method

Octal Representation

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Numeric value
✓ 7 means Full access: Read (4) + Write (2) + Execute (1)
✓ 6 means Read and Write: Read (4) + Write (2)
✓ 5 means Read and Execute: Read (4) + Execute (1)

(u) user (g) group (g) group

1 1 1 1 1 0 1 0 1

r w x r w x r w x

7 6 5

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Effects of Permissions on Files and Directories

Permissions File Permissions Directory Permissions


Read (r) Allows the user to viewing the Allows listing the directory's contents
contents of the file
Write (w) Allows the user to modifying the Allows creating or deleting files within
contents of the file the directory
Execute (x) Allows the user to executing the file Allows traversing the directory and
as a program or command accessing files and subdirectories inside
the directory

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Special Cases of Directory Permissions

✓ Read & Execute: User can list and access file contents in read-only mode but cannot modify files

✓ Read-Only: User can list file names but cannot view permissions or timestamps

✓ Execute-Only: User can cd into the directory but cannot list file names; file access requires exact names

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Directory Ownership and File Deletion

✓ Write Permissions: Directory owners or users with write access can delete files inside, regardless of file ownership or
permissions

✓ Sticky Bit: Restricts file deletion to file owners, even if others have write access to the directory

Copyright © Thinknyx Technologies LLP


Demonstration | File Ownership

Copyright © Thinknyx Technologies LLP


File Ownership

✓ Create Users and Groups


✓ Set Ownership
✓ Configure Permissions
thinknyx
✓ Test Access

Alex Bob Charlie


Owner, Developers Developers Others
group group

Copyright © Thinknyx Technologies LLP


File Ownership
➢ Effects of Permissions on Files and Directories

✓ Alex -> Full access


✓ Developers Group -> Full access
✓ Others -> No Access

Copyright © Thinknyx Technologies LLP


Linux | Manage Special
Permissions

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
u+s g+s o+t
Setuid Setgid Sticky

rwx rwx rwx

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
➢ Special Permissions

Special Permission Effect On Files Effect On Directories Use Cases


Setuid (u+s) The file runs with the permissions of No impact Used for programs requiring
the file's owner, rather than the user elevated privileges (e.g.,
executing it passwd)
Setgid (g+s) The file runs with the permissions of New files created in the Ensures group consistency or
the file's group directory inherit the group shares files among group
ownership of the directory members
Sticky Bit (o+t) No impact Users with write access can Prevents users from deleting
only delete or rename files others’ files in shared
they own; they cannot modify directories like /tmp
files owned by others

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions

thinknyx

Alex Bob Charlie


Owner, Developers Developers Others
group group

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
✓ ACLs provide fine-grained control over file and directory permissions
✓ Allow management of access for specific users or groups, even within the owning group
✓ Example: You can revoke access to a particular user from the owning group

✓ ACLs support default rules for new files and directories to ensure consistent permissions

✓ ACLs can be set during directory creation for immediate application

✓ Grants user charlie read (r) and write (w) access for new files/subdirectories
✓ ACLs offer flexibility beyond traditional rwx permissions
✓ They are powerful in multi-user environments

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
➢ Default initial permissions

File Type – whether it’s a regular file or a directory


umask – a bitmask that modifies these default permissions

Regular Files 0666 Read and Write for everyone

Directories 0777 Read, Write, and Execute for everyone

special permissions

▪ The umask is an octal bitmask that subtracts permissions from


these defaults when creating files or directories

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
➢ Regular file

Symbolic Numeric octal Numeric binary


Initial file permissions rw-rw-rw- 0666 000 110 110 110

umask -------w- 0002 000 000 000 010

Resulting file rw-rw-r-- 0664 000 110 110 100


permissions

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
➢ Directory

Symbolic Numeric octal Numeric binary


Initial file permissions rwxrwxrwx 0777 000 111 111 111

umask -------w- 0002 000 000 000 010

Resulting file rwxrwxr-x 0775 000 111 111 101


permissions

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
✓ The regular file is created with 0666 permissions (read and write for all users)

✓ The directory is created with 0777 permissions (read, write, and execute for all users)

Copyright © Thinknyx Technologies LLP


Manage Special
Permissions
✓ Regular files: Only read and write for the owner (0600)

✓ Directories: Only read, write, and execute for the owner (0700)

Copyright © Thinknyx Technologies LLP


Summary

❖ File Ownership: user, group, and others


❖ chmod: Explored octal and symbolic modes
❖ Special Permissions: SUID, SGID, and sticky bit
❖ ACLs & Umask: manage file access and default permissions

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 9
Linux | Advanced Topics on Files

Copyright © Thinknyx Technologies LLP


Advanced Topics on Files

➢ Hard links and soft links


➢ User/Shell startup files
➢ Environment variables

Copyright © Thinknyx Technologies LLP


Linux | Hard Links and Soft
Links

Copyright © Thinknyx Technologies LLP


Hard Links and Soft Links
➢ inodes

✓ Records file metadata: permissions, ownership, timestamps, and data pointers

✓ Data pointers locate the file's data on disk

✓ Each file/directory has a unique inode number

✓ File names are stored in directory entries, not inodes

Copyright © Thinknyx Technologies LLP


Hard Links and Soft Links
➢ hardlink
hardlink
✓ Comparable to database entries pointing to the
File 1 File 2
same data row

✓ Changes to one entry maintain data


consistency

✓ Directly reference the inode of a file

✓ Enable shared access without duplicating data,


saving disk space

Copyright © Thinknyx Technologies LLP


Hard Links and Soft Links
➢ In hardlink
hardlink
✓ Original file and hard link share the same inode
File 1 File 2
number

✓ Changes to one reflect in the other

✓ Deleting one does not affect other hard links

✓ Cannot span file systems or link to directories

Copyright © Thinknyx Technologies LLP


Hard Links and Soft Links
➢ softlink or symbolic/symlink
hardlink softlink or symbolic/symlink

File 1 File 2 File 1 File 2


✓ Does not store actual data, only its location

✓ Commonly used in website hosting to connect


directories (e.g., /var/www/html)

✓ Enables flexible redirection without additional storage

Copyright © Thinknyx Technologies LLP


Hard Links and Soft Links
➢ In softlink
hardlink softlink or symbolic/symlink
✓ Have a unique inode number
File 1 File 2 File 1 File 2
✓ Can span file systems and reference directories

✓ Become broken if the original file is deleted

✓ Serve as a reference, not a duplicate

Copyright © Thinknyx Technologies LLP


Hard Links and Soft
Links
hardlink softlink or symbolic/symlink

File 1 File 2 File 1 File 2

Copyright © Thinknyx Technologies LLP


Linux | User/Shell Startup Files

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
.bashrc file
/etc/skel directory

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
✓ Define aliases, variables, and functions for ease of use

✓ Automatically executed by the shell during startup

✓ Serve as setup instructions for the shell environment

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
➢ Categories of Settings in Linux

Category Description Location


Global Settings Apply to all users on the system /etc directory (e.g., /etc/profile)

User-Specific Customize or override global settings User's home directory (e.g., ~/.bashrc,
for an individual user ~/.profile)

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
➢ Shell Startup and Logout Behavior
No
✓ Login Shell: Reads /etc/profile and one of .bashrc

.bash_profile, .bash_login, or .profile (in order) Login Shell?

✓ Non-Login Shell: Reads only .bashrc


Yes .bash_profile
✓ User Preference: .bashrc is often customized as it runs
for every new terminal session
.bash_login
✓ Modern Simplification: Many systems omit
.bash_profile and .bash_login, relying on .bashrc
.profile
✓ Logout Shell: Executes .bash_logout for session
cleanup

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
➢ Environment Variables

✓ Set up by User Startup Files to configure the shell

✓ Store system and user-specific information

✓ Defined in .bashrc and .profile for persistence

✓ Are strings accessed by the shell and applications

✓ They store system preferences, user configurations, and


influence program behavior

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
➢ Defining Environment Variables

✓ Environment variables can be defined interactively in a shell session

✓ They are often defined in shell or User Startup Files for persistence across sessions

✓ Global variables are defined in /etc/profile or /etc/environment

✓ User-specific variables are defined in .bashrc, .bash_profile, or .profile

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files

command Description

set Displays all shell variables, including environment and shell-specific


ones
env Lists only environment variables

export Makes a variable available to child processes of the shell

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
HOME -> user’s home directory

PATH -> list of directories where the system looks for executable programs

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
SHELL -> default command shell for the user

PS1 -> controls the appearance of your command prompt


customize it to display useful information like the username, hostname, current directory

Copyright © Thinknyx Technologies LLP


User/Shell Startup Files
No
.bashrc

Login Shell?

Yes .bash_profile

.bash_login

.profile

Copyright © Thinknyx Technologies LLP


Summary

❖ Hard and soft links: Differences and uses


❖ Startup files: Configuring the environment during login
❖ Environment variables: Managing system settings and configurations

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 10
Linux | Package Management

Copyright © Thinknyx Technologies LLP


Package Management

➢ What is a package?
➢ Repositories and Dependencies
➢ Basic Package Management Tasks in Debian & Red hat-based
distributions
➢ Downloading Software Outside Repositories
➢ Creating Local repository in RHEL9

Copyright © Thinknyx Technologies LLP


Linux | Introduction to Packages

Copyright © Thinknyx Technologies LLP


Introduction to Packages

Copyright © Thinknyx Technologies LLP


Introduction to Packages
➢ What is Package

Install Software
Includes:
✓ Binaries
✓ Libraries
✓ Configuration files
✓ Documentation

Install Manage Software Update

Copyright © Thinknyx Technologies LLP


Repositories

Central Location

All packages for your


distribution are stored

Copyright © Thinknyx Technologies LLP


Repositories

Fetch
✓ Online stores for software
✓ Contain precompiled software packages
✓ Ready to be downloaded
Request ✓ Installed with a command

Copyright © Thinknyx Technologies LLP


Repositories

Meets different criteria like:


✓ Main Repositories
✓ Security Updates
✓ Thirt-Party software Repositories

Copyright © Thinknyx Technologies LLP


Managing Packages

Fetch

Request

✓ Text Editors
✓ Web servers
✓ Development tools

Copyright © Thinknyx Technologies LLP


Managing Packages

Everything is a file

✓ Simplifies system management


✓ Allows uniformity in how components are
accessed and manipulated

Copyright © Thinknyx Technologies LLP


Common Methods of software
installation
➢ Binary Copy

✓ Precompiled binaries
✓ Ready-to-run executables
✓ Offer quick installation
✓ Ideal for users who don’t need to modify software

Copyright © Thinknyx Technologies LLP


Common Methods of software
installation
➢ Source Code

✓ Raw programming code


✓ Written before its compiled into an executable file

Copyright © Thinknyx Technologies LLP


Common Methods of software
installation
➢ Self-Compiling Packages

✓ Require manual assurance


✓ All libraries and tools (dependencies) are installed

Tools

make cmake

Copyright © Thinknyx Technologies LLP


Package Manager
✓ Precompiled binary files
✓ Necessary installation scripts
✓ Configuration files
✓ Metadata
Bundled archives Install Upgrading Removing

✓ Provide components needed to install and manage apt yum/dnf


software efficiency
✓ Simplify process by automating resolution and installation

Copyright © Thinknyx Technologies LLP


Package Terminologies
➢ Package Formats

✓ Comes in different format


✓ Depends upon linux distribution
✓ Defines how software is packaged, distributed and installed

.deb .rpm

Copyright © Thinknyx Technologies LLP


Package Terminologies
➢ Package Manager

✓ Helps in automate installations, maintenance and removal of package

Copyright © Thinknyx Technologies LLP


Package Terminologies
➢ Repository

✓ Centralized location containing software packages


✓ Packages are tested and optimized for specific linux distributions

Debian Based Red Hat Based

“/etc/apt/source.list” “/etc/yum.repos.d”

Copyright © Thinknyx Technologies LLP


Package Terminologies
➢ Dependencies

✓ Some packages requires other packages to function correctly


✓ Tools like – apt, yum and dnf automatically handle these requirements

Copyright © Thinknyx Technologies LLP


Package Terminologies
➢ Open Source

✓ Most distributions offer open-source software packages


✓ Integrate seamlessly with system
✓ Source code can be downloaded from project website

Copyright © Thinknyx Technologies LLP


Package Management Tools
➢ apt
apt apt-get
✓ Advance Package Tool
✓ Application
✓ Libraries
✓ “.deb” for Debian based linux
Manage software packages

apt: apt-get:
✓ User-friendly, High-level interface ✓ Lower-level tool
✓ Intuitive commands ✓ Interacts more closely with core linux
✓ Enhanced security features processes
✓ Predictable behavior

Copyright © Thinknyx Technologies LLP


Package Management Tools
➢ yum

✓ Yellowdog Updater Modified


✓ Package manager for “.rpm” packages on Red-Hat based distribution

Copyright © Thinknyx Technologies LLP


Package Management Tools
➢ dnf

✓ Dandified YUM
✓ Modernized replacement for yum

Copyright © Thinknyx Technologies LLP


Package Management Tools
➢ zypper

✓ Command-line package manager for OpenSUSE and SUSE Linux Enterprise


✓ Advanced dependency resolution and repository management

Copyright © Thinknyx Technologies LLP


Linux | apt Package Manager

Copyright © Thinknyx Technologies LLP


apt Package Manager

A deb package file name is structured as:

name_version+release_architecture.deb

Example
vim_8.2.2434-3+deb11u1_amd64.deb

✓ NAME: Describes the contents of the package (e.g., vim)


✓ VERSION: The software’s version number (8.2.2434-3)
✓ RELEASE: The release number set by the packager (deb11u1)
✓ ARCHITECTURE: The CPU architecture the package is compiled for:
- amd_64: 64-bit systems
- aarch64 for ARM processors

Copyright © Thinknyx Technologies LLP


apt Package Manager
✓ dpkg focuses on individual .deb files
✓ apt acts as a user-friendly front end, streamlining tasks
- Searching repositories
- Resolving dependencies
- Handling software updates

➢ Advanced Package Tool (apt)


✓ Search for available software in the repositories
✓ Install or upgrade packages along with their dependencies
✓ Keep your system secure and up-to-date with regular updates and upgrades
✓ Remove packages or free up disk space by clearing the local cache

Copyright © Thinknyx Technologies LLP


apt Package Manager

Command Purpose Example


sudo apt update Refreshes & updates the local package cache with the latest sudo apt update
repository information
sudo apt upgrade Upgrades all installed packages to their latest versions sudo apt upgrade

sudo apt full-upgrade Installs updates, handling changes in dependencies sudo apt full-upgrade

sudo apt search Searches for a specific package in the repository sudo apt search vim
<package-name>
sudo apt install Installs a specified package along with its dependencies sudo apt install vim
<package-name>

Copyright © Thinknyx Technologies LLP


apt Package Manager

Command Purpose Example


dpkg -l List of installed packages with details like name, version, and dpkg -l
architecture
sudo apt remove Removes a specified package but keeps its configuration files sudo apt remove vim

sudo apt purge Installs updates, handling changes in dependencies sudo apt purge vim

sudo apt clean Clears the local repository cache, freeing up disk space sudo apt clean

Copyright © Thinknyx Technologies LLP


Linux | Package Manager for Red Hat
based Distributions

Copyright © Thinknyx Technologies LLP


Introduction
✓ Yum, the Yellowdog Updater Modifier
✓ Powerful package manager for Red Hat based systems like
✓ RHEL
✓ Rocky Linux
✓ Rpm, the Rat Hat Package manager
✓ Yum simplifies package management by resolving dependencies
✓ Rpm works at granular level for managing individual packages

Copyright © Thinknyx Technologies LLP


RPM
✓ Originally developed by Red Hat
✓ Simplifies software distribution by packing programs into standardized formats
✓ Easier software management
✓ Admins tract and remove installed files
✓ Ensures presence of required supporting packages
✓ Local rpm database maintains detailed records for installed packages

Copyright © Thinknyx Technologies LLP


RPM
➢ Understanding the RPM Package Name

Syntax -> name-version-release.architecture.rpm

Copyright © Thinknyx Technologies LLP


RPM
➢ Understanding the RPM Package Name

E.g. vim-minimal-8.2.2637-21.el9.x86_64.rpm

Name: Describes the contents of the package (e.g. vim-minimal


Version: The software’s version number (8.2.2637).
Release: The release number set by the packager (21.el9).
el9 indicates it’s built for Enterprise Linux 9.
ARCHITECTURE: The CPU architecture the package is compiled for:
✓ x86_64: 64-bit systems.
✓ Other examples include aarch64 for ARM processors.

Copyright © Thinknyx Technologies LLP


RPM
➢ Installing RPM Packages

Packages can be installed from


✓ Package with latest version is prioritized
✓ For multiple releases of same version, highest
release number is chosen

Repositories Local Files

Copyright © Thinknyx Technologies LLP


RPM
➢ Limitations RPM
Limitations

Dependency Manual Update


Management
✓ Doesn’t automatically fetch or ✓ Updating packages manually
resolve dependencies can be tedious

✓ To address these issues, yum and dnf were developed

Copyright © Thinknyx Technologies LLP


RPM
➢ Essential Commands

✓ rpm -q <package>: Queries if a specific package is installed

✓ rpm -qa: Lists all installed packages

✓ rpm -ivh <package.rpm>: Installs a package, fails if the package is already installed

✓ rpm -Uvh <package.rpm>: Installs or upgrades a package from a local RPM file

✓ rpm -e <package>: Removes a specific package

Copyright © Thinknyx Technologies LLP


Introduction to Yum
✓ Yellowdog Updater Modified
✓ Package management in Red Hat-based distributions like CentOS and Fedora
✓ Automates tasks like:

Resolving Dependencies Managing repositories Updating packages

User-friendly tool that made Linux package management accessible to everyone

Copyright © Thinknyx Technologies LLP


YUM
➢ Common Commands

✓ yum list - Lists available and installed packages

✓ yum search <keyword> - Searches for packages by keyword

✓ yum install <package> - Installs a package

✓ yum update - Updates all packages

✓ yum repolist - Displays enabled repositories

/etc/yum.conf - Configuration file for Yum settings

Copyright © Thinknyx Technologies LLP


DNF
✓ Modern package manager that replaces YUM
✓ In RHEL9, DNF is used for software management
✓ YUM still exists for compatibility with older versions
✓ RHEL8 and RHEL9 relies on DNF, but maintain compatibility with YUM

Copyright © Thinknyx Technologies LLP


DNF
✓ Evolved to dnf
✓ Successor to Yum, introduced in Fedora 22 and adopted in RHEL 8+.
✓ Enhanced performance and better memory management.
✓ Improved dependency resolution and faster metadata processing.

Copyright © Thinknyx Technologies LLP


DNF
➢ Common Commands

✓ dnf install <package>: Installs a specified package along with dependencies.

✓ dnf remove <package>: Removes a package and its unused dependencies.

✓ dnf update: Updates all installed packages to their latest versions.

✓ dnf list: Lists available or installed packages in the system.

Copyright © Thinknyx Technologies LLP


Demonstration | Create a local repository in RHEL9

Copyright © Thinknyx Technologies LLP


Creating Local Repository
✓ Essential for managing software installations

Centralized Package
✓ Limited Ensure Consistency
Management
✓ Restricted
Software Installations ✓ Unavailable
Updates in Environment
Save Bandwidth Offline Access

Copyright © Thinknyx Technologies LLP


Summary

❖ The basics of package


❖ APT package manager in Ubuntu
❖ Red Hat based package manager: rpm, yum and dnf
❖ Creation of local repo in rhel9

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 11
Linux | Introduction to Process
Management

Copyright © Thinknyx Technologies LLP


Process Management

➢ Processes and their lifecycle


➢ Manage processes using various commands
➢ Process priority
➢ Foreground and Background processes

Copyright © Thinknyx Technologies LLP


Linux | Introduction to Processes

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ What is a Process?

✓ A process is a running instance of a program


✓ When you open an app, like a web browser, it becomes a process on your system
✓ In simple terms, a process is a program that's currently running

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ What are Threads?

✓ A thread is the smallest unit of work in a process


✓ Each process has a main thread and can create more for multitasking
✓ Threads share memory, making them lightweight and efficient on multi-core systems

Memory Space
Process
Thread

Thread

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Processes and Resources

✓ Processes use memory, CPU, and devices like network cards and hard drives
✓ The kernel manages resource allocation to optimize performance

Operating System

Process 1

Process 2 Memory

Linux CPU
Process n Kernel

Physical and logical


resources

Processes

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Process Creation in Linux

✓ All processes start from systemd, the first system process


✓ Parent processes create child processes using the fork mechanism, inheriting resources like file
access and environment variables
✓ The child process often uses exec to replace its inherited code with a new program
✓ Each process has a unique PID and a PPID (Parent Process ID)
✓ The parent "sleeps" while the child runs and clears unused resources after the child finishes

PARENT
fork exec
CHILD

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Process Lifecycle in Linux

✓ A script runs as a process, moving through various states


✓ The scheduler allocates CPU time based on priority and time needed

results

.PY
Python interpreter

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Created (New)
fork

(new)

✓ The OS uses fork to create a new process for the Python interpreter
✓ The process exists but hasn’t started executing yet
✓ It waits to be admitted into the scheduler’s queue, with no specific state
identifier until then

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Ready (R)
fork

schedule R
(new) Runnable
(ready)

✓ After creation, the process enters the Ready state (R)


✓ The scheduler adds the process to its queue, waiting for its turn to use the CPU
✓ The scheduler evaluates the queue based on priority and fairness to decide the
next process to run

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Running (R)
fork

R run R
schedule Running
(new) Runnable
(ready) (on a CPU)
reschedule

✓ Once assigned the CPU, the process enters the Running state (R)
✓ The Python script executes tasks like opening files, reading, and processing data
✓ The scheduler periodically switches processes to ensure fairness, so the script may not stay
in this state continuously

Copyright © Thinknyx Technologies LLP


Introduction to Processes
➢ Sleeping (S or D)
fork

R run R
schedule Running
(new) Runnable
(ready) (on a CPU)
reschedule

event or wait
signal

D S
Sleeping

✓ The process enters Sleeping state when it pauses, waiting for resources like file data or database input

✓ Interruptible Sleep (S) allows the process to wake up when the resource is ready or a signal is received

✓ Uninterruptible Sleep (D) occurs when the process waits for a critical resource and can't be interrupted

✓ During sleep, the scheduler focuses on other processes that are ready to run

Copyright © Thinknyx Technologies LLP


Introduction to Processes T
Stopped

➢ Stopped (T)
suspend resume
fork

R run R
schedule Running
(new) Runnable
(ready) (on a CPU)
reschedule

event or wait
signal

D S
Sleeping

✓ When manually paused (e.g., pressing Ctrl+Z), the process enters the Stopped state (T)

✓ The process halts execution, releases the CPU, but stays in memory
✓ It can be resumed later using the fg (foreground) command
✓ While stopped, the scheduler does not allocate CPU time to the process

Copyright © Thinknyx Technologies LLP


Introduction to Processes T
Stopped

➢ Zombie (Z)
suspend resume
fork

R run R Z
(new) schedule
Runnable Running exit
Zombie
(ready) (on a CPU)
reschedule

event or wait
signal

D S
Sleeping

✓ After execution, the process enters the Zombie state (Z)


✓ The process has completed its work, but the parent process hasn’t acknowledged its exit status
✓ This state is transitional and doesn’t consume system resources
✓ The scheduler is not involved, as the process is no longer active

Copyright © Thinknyx Technologies LLP


Introduction to Processes T
Stopped

➢ Terminated (Dead)
suspend resume
terminate
fork

R run R Z
(new) schedule
Runnable Running exit
Zombie
(ready) (on a CPU)
reschedule

event or wait
signal

D S
Sleeping

✓ After the parent process acknowledges termination, the process enters the Terminated state
✓ All resources (memory, file handles) are freed, and the process is removed from the system
✓ The process no longer exists in the process table
✓ The scheduler's role is finished, marking the end of the script's lifecycle

Copyright © Thinknyx Technologies LLP


Introduction to Processes

T
Stopped

suspend resume
fork terminate

R run R Z
(new) schedule Runnable Running exit
Zombie
(ready) reschedule (on a CPU)

event or wait
signal

D S
Sleeping

Copyright © Thinknyx Technologies LLP


Linux | Process Management

Copyright © Thinknyx Technologies LLP


Process Management
➢ Fundamental Commands Related to Processes

Command Description Syntax Usage


pidof Finds the process ID of a running pidof [options] pidof sshd
program <program_name>
ps Displays information about a ps [options] ps aux
selection of the active processes
pstree Shows running processes as a tree pstree [options] pstree

psgrep Searches for processes by name and pgrep [options] <pattern> pgrep -u user1
returns their process IDs

Copyright © Thinknyx Technologies LLP


a all users

u user, CPU, and memory usage

x not tied to a specific terminal

Copyright © Thinknyx Technologies LLP


Process
Management
➢ Kill Command

Copyright © Thinknyx Technologies LLP


Process
Management
➢ Kill Command

✓ Terminate the Process


✓ Free Up Resources
✓ Restore Server Performance
✓ Maintain User Experience

Copyright © Thinknyx Technologies LLP


Process
Management
➢ Kill Command

✓ Sends signals to manage processes, such as TERM,


KILL, or STOP
✓ Default signal: TERM (graceful termination)
✓ KILL: Forcefully stops a process

✓ STOP: Pauses the process

Copyright © Thinknyx Technologies LLP


Process
Management
➢ Kill Command

✓ Only owners or root users can kill processes

✓ The term "kill" can be misleading


✓ The command sends various signals, not limited to
termination

Copyright © Thinknyx Technologies LLP


Process
Management

Copyright © Thinknyx Technologies LLP


Process
Management
➢ Syntax for the kill command

kill [options] <pid>

Signal number (e.g., 9 for SIGKILL)


Full signal name (e.g., SIGKILL)
Signal name without the SIG prefix (e.g., KILL)

Copyright © Thinknyx Technologies LLP


Process
Management
PID Value Effect

PID > 0 Signal targets the process with the specified PID

PID = 0 Signal targets all processes in the current process group

PID = -1 Signal targets all user-owned processes; as root, it excludes init and
itself
PID < -1 Signal targets all processes in the group with a GID matching the
absolute value of the PID

✓ Use signal names, not numbers, for consistency and cross-platform portability

Copyright © Thinknyx Technologies LLP


Process
Management
killall

✓ Unsure of the process ID or prefer to target processes by name

pkill

✓ Sends signals to processes based on names, more flexible than killall

✓ Uses pgrep criteria (name, user, pattern) to target processes

Copyright © Thinknyx Technologies LLP


Process
Management
For example

Default signal (SIGTERM) to all matching processes

Additional options -> terminal (-t) or session (-s)

Copyright © Thinknyx Technologies LLP


Process
Management
➢ SIGTERM vs SIGKILL

✓ Avoid killing system processes to prevent instability or crashes

✓ SIGTERM: Gracefully terminates processes

✓ SIGKILL: Forcefully terminates without cleanup, causing potential issues

✓ Use signals carefully to avoid unintended consequences

Copyright © Thinknyx Technologies LLP


Linux | Process Priorities

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Nice and Renice

✓ Lower nice value = Higher priority

✓ Higher nice value = Lower priority

CPU=Chef
Processes=Order Scheduler=Manager

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Adjusting Process Priority
❑ nice Command

✓ Used when starting a process

✓ Sets the initial priority

❑ renice Command

✓ Used for running processes

✓ Dynamically adjusts priority

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Process Priority in Multi-Core Systems

✓ Parallel Execution: Processes run on multiple cores

✓ Priority Matters: Higher priority processes are favored


✓ Optimized Performance: Tasks balanced across cores

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Understanding Nice Values

✓ Range: -20 (highest priority) to 19 (lowest priority)

✓ High Priority (-20): Receives more CPU time


✓ Low Priority (19): CPU favors higher-priority processes first

✓ Default: 0

Ensures fair CPU resource allocation

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Monitoring System Performance: top vs. ps
❑ ps Command

✓ Provides a static snapshot of processes


✓ Requires manual reruns for updates
✓ Useful for specific point-in-time process data

❑ top Command

✓ Offers real-time, dynamic updates (default: every 2


seconds[Interval updates can be customized])
✓ Displays processes consuming the most CPU and memory
✓ Allows for continuous monitoring without rerunning commands

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Why Use top?

✓ Efficient for ongoing performance tracking

✓ Easier to monitor system health dynamically

Copyright © Thinknyx Technologies LLP


Process Priorities
➢ Understanding Load Average

✓ Shows processes waiting for CPU time

✓ Load of 1 fully uses a single-core CPU; >1 causes contention

✓ Multi-core ideal load matches core count (e.g., 4 cores = load of 4)

✓ High load suggests CPU overuse or system issues

Copyright © Thinknyx Technologies LLP


Process Priorities

✓ High kernel time (sy) with low user time (us) suggests system-level issues

✓ Low idle time with high us or sy indicates heavy CPU usage

✓ High wa values suggest memory or disk bottlenecks, with the CPU waiting on storage

✓ High hi or si indicates hardware or software interruption issues

✓ High st values suggest the host system is overloaded, affecting the VM's performance

Copyright © Thinknyx Technologies LLP


Linux | Foreground and Background
Processes

Copyright © Thinknyx Technologies LLP


Foreground and Background
Processes
✓ Foreground: Directly interacted with in the terminal, blocking other tasks until
finished or stopped

✓ Background: Run independently, allowing terminal use for other tasks while still being
monitored or controlled

Copyright © Thinknyx Technologies LLP


Foreground and Background Processes

Command Description Syntax Usage


jobs Lists all background jobs and their jobs jobs
statuses
fg Brings a background process to the fg %<job_id> fg %1
foreground
bg Resumes a paused process in the bg %<job_id> bg %1
background

✓ The kernel also runs background processes (kernel threads) for essential system tasks

Copyright © Thinknyx Technologies LLP


Summary

❖ Concept of processes and their lifecycle


❖ Process states: ready, sleep and stop
❖ Managing Processes: pidof, ps and kill
❖ Process Priorities: nice and renice
❖ Real-Time Monitoring: top
❖ Foreground and Background Processes: fg, bg and jobs

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 12
Linux | Service
Management

Copyright © Thinknyx Technologies LLP


Service Management

➢ Service management concepts


➢ Commands for managing services in Linux
➢ systemd and systemctl
➢ Install Apache on Ubuntu
➢ Manage Apache service using systemctl

Copyright © Thinknyx Technologies LLP


Linux | Introduction to Service
Management

Copyright © Thinknyx Technologies LLP


Service Management

✓ Web servers, databases, and logging systems run smoothly without


manual intervention. How?

Copyright © Thinknyx Technologies LLP


Service Management
➢ Services

✓ Are background processes vital for system operation


✓ Handle tasks like networking, scheduling, and more
✓ Manage critical tasks like web hosting and database access
✓ Service management controls how services start, stop, and interact

Copyright © Thinknyx Technologies LLP


Service Management
➢ SysVinit VS Systemd
❑ SysVinit ➢ Systemd
✓ Linux used the SysVinit system for managing services ✓ Modern replacement for SysVinit
✓ Launched essential services during system boot ✓ Introducing features like parallel startup,
✓ SysVinit faced challenges like managing dependencies dependency resolution, and robust logging
between services
✓ Handles entire boot process, ensures
system resources allocated efficiently
✓ SysVinit lacked an efficient way to handle dependencies ✓ Tracks all processes

✓ delays or even failures during startup

Copyright © Thinknyx Technologies LLP


Service Management
➢ Daemons

✓ Daemons are a subset of services managed by tools like systemd


✓ Processes designed to run continuously in the background
✓ Systemd interacts with these daemons to control their lifecycle

For Example
✓ Systemd initializes the sshd daemon, which handles secure remote logins
✓ Systemd can restart a daemon if it fails
✓ Services remain available without manual intervention

Copyright © Thinknyx Technologies LLP


Service Management

Startup Configuration

Understanding
Daemons

Continuous Operation User Interaction

Copyright © Thinknyx Technologies LLP


Service Management
➢ Examples of Daemons

crond mysqld systemd-journald


httpd

Copyright © Thinknyx Technologies LLP


Linux | Role of
systemd

Copyright © Thinknyx Technologies LLP


Role of
systemd
✓ Systemd is responsible for initializing the system and managing services
✓ Services are launched in the correct order and handles dependencies between services
✓ Responsible for controlling the lifecycle of services

Copyright © Thinknyx Technologies LLP


Role of
systemd
➢ Key roles of systemd

❑ Boot the System

✓ Kernel loads and initializes systemd

✓ It initializes the system by launching essential services

✓ It optimizes the boot process using parallelization

❑ Control Services

✓ Start, stop, restart, enable, or disable services

✓ Handle dependencies between services

✓ Use timers to schedule tasks

Copyright © Thinknyx Technologies LLP


Role of
systemd
➢ Key roles of systemd

❑ Resource Management

✓ Integrates with cgroups (control groups) to monitor and


control resource

❑ Logging and Troubleshooting

✓ Systemd includes journalctl, a centralized logging utility

✓ Logs are invaluable for troubleshooting and auditing

Copyright © Thinknyx Technologies LLP


Role of
systemd
➢ Key roles of systemd

❑ Power and Session Management

✓ Handles power management tasks like shutting down,


rebooting, and hibernating the system

❑ Advanced Networking and System States

✓ Supports managing network configurations using systemd-networkd

✓ Logs are invaluable for troubleshooting and auditing

Copyright © Thinknyx Technologies LLP


Role of
systemd
➢ Systemd introduces units

✓ Services

✓ Sockets

✓ Devices

✓ Timers

Copyright © Thinknyx Technologies LLP


Role of
systemd
➢ Important systemd units

Service Units (.service)

Socket Units (.socket)

Path Units (.path)

Copyright © Thinknyx Technologies LLP


Linux | Introduction to systemctl

Copyright © Thinknyx Technologies LLP


Introduction to
systemctl
Command Description Usage
systemctl start Starts a service immediately systemctl start apache2
<service>
systemctl stop Stops a running service systemctl stop apache2
<service>
systemctl restart Stops and then starts a service. systemctl restart apache2
<service> Useful after config changes
systemctl reload Reloads a service without stopping it systemctl reload apache2
<service>
systemctl enable Configures the service to start systemctl enable apache2
<service> automatically on boot
systemctl disable Prevents the service from starting on systemctl disable apache2
<service> boot

Copyright © Thinknyx Technologies LLP


Introduction to
systemctl
Command Description Usage
systemctl status Displays the current status of a systemctl status apache2
<service> service (e.g., active or inactive)
systemctl is-active Checks if the service is currently systemctl is-active apache2
<service> running
systemctl is-enabled Checks if the service is set to start on systemctl is-enabled apache2
<service> boot
systemctl list-units Lists all the systemd units currently systemctl list-units
loaded
systemctl list-units -- Lists systemd units & filters by type, systemctl list-units --
type service --all as services type=service

Copyright © Thinknyx Technologies LLP


Demonstration | Managing Services

Copyright © Thinknyx Technologies LLP


User Management
File Description

UNIT Service unit name, e.g., cron.service

LOAD Loaded into memory; typically shows loaded if successful

ACTIVE Common states include active or inactive

SUB Detailed state, varies by service type and behavior, e.g., running,
exited, waiting (active), or dead, failed (inactive)
Description Brief purpose of the service

Copyright © Thinknyx Technologies LLP


User Management
Active State Description

active (exited) Service started successfully and completed its task (one-shot)

active (waiting) Service running but waiting for an event or condition to proceed

Copyright © Thinknyx Technologies LLP


Summary

❖ Services and daemons


❖ Role of systemd in service management
❖ Common systemctl commands
❖ Installed and managed Apache2 using systemctl

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 13
Linux | Disk Partitioning

Copyright © Thinknyx Technologies LLP


Disk Partitioning

➢ Types of filesystems
➢ Fundamentals of disk partitioning
➢ Demonstration of creating and managing disk partitions

Copyright © Thinknyx Technologies LLP


Linux | Filesystem Types

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ What is a Filesystem?

✓ Defines how data is stored, accessed, and organized

✓ Manages file naming, directory structure, and metadata

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Filesystem Types

✓ Specific implementations of file storage structures

✓ Each offers unique features, optimizations, and limitations

✓ Suitable for different scenarios

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Journaling

✓ Used by ext4, XFS to ensure data consistency

✓ Logs changes before applying them

✓ Enables recovery from crashes, preventing data corruption

✓ Replays journal on restart to apply or roll back changes

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Inodes

✓ Data structures storing information about files and directories

✓ Contain metadata: size, permissions, timestamps, and pointers to data blocks

✓ Help manage and access files efficiently by separating metadata from content

✓ Enables recovery from crashes, preventing data corruption

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Popular Filesystem Types

ext4 (Fourth Extended ✓ Default for many Linux distributions


Filesystem)
✓ Uses journaling for crash recovery
✓ Stores metadata in inodes (permissions, timestamps, data pointers)
✓ Reliable and performs well for general-use scenarios

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Popular Filesystem Types

XFS (Extended ✓ High-performance filesystem with journaling for data consistency


Filesystem)
✓ Uses B-trees for better scalability and faster file lookups
✓ Ideal for large filesystems like databases and high-capacity servers

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Popular Filesystem Types

Btrfs (B-Tree Filesystem) ✓ Modern filesystem with advanced features:


- Snapshots
- Data checksumming
- Copy-on-write (COW) for efficient storage
✓ Supports dynamic resizing and data integrity in complex storage setups

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Popular Filesystem Types

Tmpfs (Temporary ✓ Stored in RAM for ultra-fast access


Filesystem)
✓ Used for temporary data that disappears after a reboot
✓ Commonly used for system directories like /tmp and /var/run

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Popular Filesystem Types

NFS (Network File ✓ Allows file sharing over a network


System)
✓ Used in distributed environments where multiple systems need shared access
✓ Ideal for remote storage solutions

Copyright © Thinknyx Technologies LLP


Filesystem Types
➢ Choosing the Right Filesystem

✓ Essential for optimizing performance and ensuring data integrity

✓ Helps meet specific use cases based on system requirements

✓ Understanding filesystems aids in effective disk partitioning

✓ Ensures the system is customized for its workload

Copyright © Thinknyx Technologies LLP


Linux | Introduction to Disk Partitioning

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
Root Disk (Boot Disk): Default disk for OS, not ideal for storing application data

➢ Impact of Storing Application Data on Root Disk:

✓ Consumes significant disk space and I/O resources


✓ Can slow down OS and critical system processes
✓ Increases the risk of accidental modification or exposure of sensitive system files

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Setup

Amazon EC2

Amazon EBS Boot


Disk
(Runs OS)

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Optimizing Storage with AWS EBS

Amazon EBS Data


Amazon EC2 Disk

✓ Scalable, high-performance storage separate from the root disk

✓ Reduces load on the OS, enhancing performance and reliability

Amazon EBS Boot


Disk
(Runs OS)

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Partitioning

✓ Divides a disk into smaller, logical sections


✓ Enhances organization and manageability

➢ Types of partitions
Partition

Primary (4)
Extended

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Partitioning

500GB disk

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Partitioning

500GB disk
Primary Partitions

Extended Partition ✓ GPT (GUID Partition Table)- No Limit


100GB 100GB 100GB 200GB
✓ MBR (Master Boot Record) - 15

100GB 100GB

Logical Partitions

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Understanding Sectors

✓ Smallest unit of data storage on a disk (typically 512 bytes)


✓ Disk platters are divided into tracks, which are further divided into sectors

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Partitioning

500GB disk
Primary Partitions

Extended Partition
100GB 100GB 100GB 200GB

2048 sectors
reserved

100GB 100GB

Logical Partitions
2048 sectors
reserved

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Creating a Filesystem

✓ Partitioning alone isn't enough; a filesystem is required


✓ Filesystems like ext4 and XFS enable reading and writing
✓ Formatting prepares the partition to store files and directories

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Creating a Mount Point (Directory)

✓ Create a directory as the mount point


✓ This directory serves as the access point for partition data

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Mounting the Filesystem

✓ Temporary Mounting: Uses the mount command; lost after a reboot


✓ Permanent Mounting: Updates /etc/fstab to ensure automatic mounting at boot

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Unmounting and Decommissioning

❑ To securely decommission a disk

✓ Delete the data


✓ Remove the partition table
✓ Reformat the disk

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
Key Steps Summary

Create an EBS Volume Partition the Volume

Create a Filesystem Create a Mount Point

Mount the Filesystem Unmount and Decommission

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Disk Management Commands

Command Description Syntax


lsblk Lists all block devices, including disks and partitions lsblk

blkid Displays UUIDs of disks and partitions blkid

fdisk -l Lists all disks and partitions (MBR partitioning) fdisk -l

df -h Displays disk space usage for mounted filesystems df -h

fdisk /dev/sdX Opens fdisk to create or manage partitions fdisk /dev/sdX

Copyright © Thinknyx Technologies LLP


Introduction to Disk Partitioning
➢ Disk Management Commands

Command Description Syntax


mkfs.<filesystem> Creates filesystem on a partition mkfs.xfs /dev/sdX1
/dev/sdX1
mount -a Mounts all filesystems listed in /etc/fstab mount -a

umount /mnt Unmounts the partition mounted at /mnt umount /mnt

Copyright © Thinknyx Technologies LLP


Demonstration | Disk Partitioning

Copyright © Thinknyx Technologies LLP


Summary

❖ Types of filesystems and their use cases


❖ Concepts and commands related to disk partitioning
❖ Demonstrated partitioning an EBS volume and creating a
filesystem on it

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 14
Linux | Logical Volume Manager (LVM)

Copyright © Thinknyx Technologies LLP


LVM

➢ LVM overview, key components, advantages, and essential commands

➢ Practical demonstration of the LVM lifecycle on AWS EC2

Copyright © Thinknyx Technologies LLP


Linux | Introduction to LVM

Copyright © Thinknyx Technologies LLP


LVM
➢ Traditional Disk Management & Its Limitations

✓ Involves attaching, formatting, partitioning, and creating filesystems

✓ Works well in static environments but has limitations in dynamic settings

✓ Unused disk space remains inaccessible (e.g., 500GB disk with 400GB used)
500GB

wasted
400GB 100GB

✓ Expanding the filesystem often requires reformatting, risking data loss and downtime

Copyright © Thinknyx Technologies LLP


LVM
➢ Introduction to LVM

✓ LVM overcomes traditional disk management limitations

✓ Provides flexible and dynamic storage management

✓ Decouples physical storage from logical storage

✓ Allows resizing filesystems on the fly without downtime

Copyright © Thinknyx Technologies LLP


LVM

Copyright © Thinknyx Technologies LLP


LVM
➢ Physical Shelves

Copyright © Thinknyx Technologies LLP


LVM
➢ Section Labels
Science

Universe

Languages

Fictional

Copyright © Thinknyx Technologies LLP


LVM
➢ Catalog Entries
Science Catalog
1. 6. 11.
2. 7. 12.
3. 8. 13.
4. 9.
5. 10.

Universe
1. 6. 11.
2. 7. 12.
3. 8. 13.
4. 9.
5. 10.

Languages
1. 6. 11.
2. 7. 12.
3. 8. 13.
4. 9.
5. 10.

Fictional
1. 7. 13.
2. 8. 14.
3. 9. 15.
4. 10.
5. 11.
6. 12.

Side view

Copyright © Thinknyx Technologies LLP


LVM
➢ Key Components of LVM

❑ Physical Volumes (PVs)


✓ Raw storage devices or disk partitions
✓ Initialized as PVs instead of direct disk usage
✓ Can be pooled with other PVs for better storage
management
✓ Similar to individual shelves in a library

Physical Volume (PV) Physical Physical Physical


Volume Volume Volume

Copyright © Thinknyx Technologies LLP


LVM
➢ Key Components of LVM

❑ Volume Groups (VGs)


✓ Collections of multiple Physical Volumes (PVs)
✓ Form a single, unified storage resource
✓ Similar to library sections organizing multiple shelves
✓ Enable efficient storage allocation based on needs
(e.g., application data, databases)
Volume Group (VG) Volume Group

Physical Volume (PV) Physical Physical Physical


Volume Volume Volume

Copyright © Thinknyx Technologies LLP


LVM
➢ Key Components of LVM

❑ Logical Volumes (LVs)


✓ Resizable virtual partitions within a Volume Group
(VG)
✓ Similar to books cataloged in a library section
✓ Divide storage into manageable units Logical Volume (LV) Logical Logical
Volume Volume
✓ Function like traditional partitions but can be
expanded or reduced dynamically Volume Group (VG) Volume Group

Physical Volume (PV) Physical Physical Physical


Volume Volume Volume

Copyright © Thinknyx Technologies LLP


LVM
➢ Key Components of LVM

❑ Key Advantage of LVM


File File
✓ Filesystem resides on top of the Logical Volume (LV) System System

✓ Allows on-the-fly resizing without downtime


✓ Supports expanding or shrinking storage as needed
Logical Volume (LV) Logical Logical
✓ Ideal for production environments requiring Volume Volume

uninterrupted access
Volume Group (VG) Volume Group

Physical Volume (PV) Physical Physical Physical


Volume Volume Volume

Copyright © Thinknyx Technologies LLP


LVM
➢ Implementing LVM for Dynamic Storage Management

✓ Involves attaching, formatting, partitioning, and


File File
creating filesystems System System

✓ Works well in static environments but has


limitations in dynamic settings Logical Volume (LV) Logical Logical
Volume Volume

✓ Unused disk space remains inaccessible (e.g., 500GB


disk with 400GB used) Volume Group (VG) Volume Group
500GB

400GB 100GB Physical Volume (PV) File File File


✓ Expanding the filesystem often requires System System System

reformatting, risking data loss and downtime

Copyright © Thinknyx Technologies LLP


LVM
➢ Key Components of LVM

File File
System System

Logical Volume (LV)

Logical Logical
Volume Volume

500GB Volume Group (VG)

Volume Group

Physical Volume (PV)

File File File


System System System

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM offers several advantages

✓ Combines multiple devices into one logical volume


Flexible Capacity
✓ Allows filesystems to span multiple devices

✓ Resize Logical Volumes easily without reformatting


Resizable Storage Volumes
✓ Adjust storage on demand

✓ Move data between devices within a Volume Group


Online Data Relocation
✓ Perform maintenance or upgrades without downtime

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM offers several advantages

✓ Create read-only or read-write copies of a Logical Volume


Snapshot Support ✓ Useful for backups and testing
✓ Capture a consistent state without disrupting operations

✓ Reduces wasted space by pooling storage resources


Improved Disk Utilization
✓ Logical Volumes can be resized as needed for better efficiency

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM2 Enhancements

✓ Improved metadata storage and recovery formats


✓ Increased flexibility and reliability in storage management

Copyright © Thinknyx Technologies LLP


LVM
➢ Real-world scenario

appdata

applogs
database

➢ Limitations of Traditional Partitioning

✓ Fixed storage allocation can lead to imbalances

✓ Expanding partitions may require reformatting or migration

✓ Risk of downtime and potential data loss

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM for Scalable Storage

Disk 1 PV 1

VG 1 LV 1 /appdata

Disk 2 PV 2 app VG

Disk 3 PV 3

VG 2 LV 2 /database

Disk 4 PV 4 data VG

LINUX

Copyright © Thinknyx Technologies LLP


LVM
➢ Implementing LVM for Dynamic Storage Management
LVM (Logical Volume Manager
✓ Attaching Multiple Disks to an EC2 Instance
File Systems /appdata (XFS) /data (XFS)

✓ Initializing Physical Volumes (PVs)


Logical Volumes appvol1 datavol1
✓ Creating a Volume Group (VG)

✓ Creating Logical Volumes (LVs) Volume Group appvg datavg

✓ Formatting LVs with a Filesystem


Physical Volumes /dev/xvdf /dev/xvdg /dev/xvdh

✓ Creating Directories as Mount Points

✓ Mounting Filesystems Disk Partitions /dev/xvdf /dev/xvdg /dev/xvdh

✓ Decommissioning and Cleanup


Hard Disks /dev/sdf /dev/sdg /dev/sdh
mkdir
mkfs
mount

Copyright © Thinknyx Technologies LLP


LVM
➢ Implementing LVM for Dynamic Storage Management
LVM (Logical Volume Manager
✓ Attaching Multiple Disks to an EC2 Instance
File Systems /appdata (XFS) /data (XFS)

✓ Initializing Physical Volumes (PVs)


Logical Volumes appvol1 datavol1
✓ Creating a Volume Group (VG)

✓ Creating Logical Volumes (LVs) Volume Group appvg datavg

✓ Formatting LVs with a Filesystem


Physical Volumes /dev/xvdf /dev/xvdg /dev/xvdh

✓ Creating Directories as Mount Points

✓ Mounting Filesystems Disk Partitions /dev/xvdf /dev/xvdg /dev/xvdh

✓ Decommissioning and Cleanup


Hard Disks /dev/sdf /dev/sdg /dev/sdh

Copyright © Thinknyx Technologies LLP


LVM
LVM (Logical Volume Manager
File Systems /appdata (XFS) /data (XFS)

Logical Volumes appvol1 datavol1

Volume Group appvg datavg

Physical Volumes /dev/xvdf /dev/xvdg /dev/xvdh

Disk Partitions /dev/xvdf /dev/xvdg /dev/xvdh

Hard Disks /dev/sdf /dev/sdg /dev/sdh

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM Management Commands

❑ Physical Volume (PV) Management

Command Description Syntax


pvcreate Initializes a disk as a physical volume System is unusable

pvdisplay Displays information about a physical pvdisplay /dev/xvdf


volume
pvs Displays a summary of physical pvs
volumes
pvscan Scans all disks for physical volumes pvscan

pvremove Removes a physical volume pvremove /dev/xvdf

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM Management Commands

❑ Volume Group (VG) Management

Command Description Syntax


vgcreate Creates a volume group from one or vgcreate datavg /dev/xvdf
more physical volumes
vgextend Adds a new physical volume to an vgextend appvg /dev/xvdg
existing volume group
vgdisplay Displays detailed information about a vgdisplay datavg
volume group
vgs Displays a summary of volume groups vgs

vgscan Scans all disks for volume groups and vgscan


detects new ones
vgreduce Removes a physical volume from a vgreduce datavg /dev/xvdf
volume group
vgremove Removes a volume group vgremove datavg

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM Management Commands

❑ Logical Volume (LV) Management

Command Description Syntax


lvmdiskscan Scans for block devices that can be lvmdiskscan
used as physical volumes
lvcreate Creates a logical volume within a lvcreate -l 100%FREE -n datavol1
volume group datavg
lvextend Extends the size of a logical volume lvextend -L +6G
/dev/appvg/appvol1
lvreduce Reduces the size of a logical volume lvreduce -L -5G
(use with caution)
lvdisplay Displays detailed information about a lvdisplay /dev/datavg/datavol1
logical volume
lvs Displays a summary of logical lvs
volumes
lvremove Removes a logical volume lvremove /dev/datavg/datavol1

Copyright © Thinknyx Technologies LLP


LVM
➢ LVM Management Commands

❑ Filesystem Management

Command Description Syntax


xfs_growfs Expands a mounted XFS filesystem xfs_growfs /appdata
after resizing a logical volume

resize2fs Expands a mounted ext2/ext3/ext4 resize2fs /dev/appvg/appvol1


filesystem after resizing a logical
volume

Copyright © Thinknyx Technologies LLP


Demonstration | LVM

Copyright © Thinknyx Technologies LLP


Summary

❖ LVM overview: components, advantages, and commands


❖ Demonstrated LVM lifecycle on AWS EC2
❖ Created, extended, and resized volumes
❖ Decommissioned EBS volumes

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 16
Linux | Introduction to SSH

Copyright © Thinknyx Technologies LLP


SSH

➢ SSH is and its key components such as ssh, sshd, and scp
➢ SSH configuration file (sshd_config)
➢ Brief of DHCP (Dynamic Host Configuration Protocol)
➢ Demonstration to set up passwordless authentication

Copyright © Thinknyx Technologies LLP


Linux | SSH Client/Server

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ SSH

✓ Secure Shell
✓ Protocol used for securely connecting to remote systems over a network
✓ Secure, encrypted channel between a local machine and a remote machine

➢ Telnet and FTP transmitted data ➢ SSH


- Including passwords ✓ Uses encryption to ensure that the communication
between the client and server is secure
vulnerable to attacks

Copyright © Thinknyx Technologies LLP


SSH Client/Server

Cloud Server
Personal Machine
Production System

Copyright © Thinknyx Technologies LLP


SSH Client/Server

SSH Protocol

SSH Client SSH Server

✓ The SSH client connects to the remote machine via port 22


✓ The remote server’s SSH daemon (sshd) listens on this port and handles incoming connections

✓ Once authenticated (via password or key-based authentication), the server grants access to
the client

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ Connect to Remote Host

ssh -i "thinknyx.pem" [email protected]

➢ Private Key and Public Key Authentication

✓ A pair of cryptographic keys


- A private key and a public key
✓ Private key is kept on the client machine
✓ Public key is stored on the server in the authorized_keys file
✓ Public key on the server matches the private key
✓ Connection is authenticated without needing a password

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ sshd (SSH Daemon)
✓ OpenSSH server process responsible for handling incoming connections via the SSH protocol

- User authentication
- Encryption
- Terminal sessions
- File transfers
- Tunneling
➢ sshd (SSH Daemon)

✓ sudo systemctl stop ssh # To Stop the SSH service


✓ sudo systemctl start ssh # To Start the SSH service
✓ sudo systemctl restart ssh # Restart the SSH service after configuration changes
✓ sudo systemctl reload ssh # Without stopping just Reload the SSH service after configuration changes

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ Configuration Files for SSH
✓ sshd_config (the server-side configuration file)
✓ authorized_keys (where public keys are stored)

❑ /etc/ssh/sshd_config

✓ Primary configuration file for the SSH daemon

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ Configuration Files for SSH
✓ sshd_config (the server-side configuration file)
✓ authorized_keys (where public keys are stored)

❑ /etc/ssh/sshd_config

✓ Primary configuration file for the SSH daemon

❑ ~/.ssh/authorized_keys

✓ File holds the public keys of clients that are authorized


to access the server

Copyright © Thinknyx Technologies LLP


Demonstration | Password Authentication

Copyright © Thinknyx Technologies LLP


Demonstration | Key-Based Authentication

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ Introduction to SCP (Secure Copy)

scp [options] <path_of_file/filename>remoteuser@ip_address_remote_server:~/path_of_destination_directoty/

❑ Some of the common options:


✓ -r for Recursive copy of entire directories
✓ -i for identity file

Copyright © Thinknyx Technologies LLP


SSH Client/Server
➢ Steps followed for key based authentication:

✓ Modify SSH settings in the sshd_config file on the VM, to enable key based authentication
✓ Create a new Ubuntu VM (ubuntu_2) with the same configuration as the first VM
✓ Generate SSH Key Pair(public and private keys) Locally
✓ Transfer the Private Key to the Remote Server ubuntu_1 using scp command
✓ Set the mininmum permissions on the private key file on the remote server using chmod
✓ Transfer the Public Key to both the Remote Servers, ubuntu_1 and ubuntu_2
✓ Now to test SSH Connections:
- SSH into ubuntu_1 using the private key
- SSH into ubuntu_2, without a key and password, to ensure key-based authentication works

Copyright © Thinknyx Technologies LLP


Linux | DHCP

Copyright © Thinknyx Technologies LLP


DHCP
➢ DHCP (Dynamic Host Configuration Protocol)
✓ Network protocol automatically assign IP addresses to devices on network

✓ Allows devices to receive IP address dynamically from DHCP server

❑ Role of DHCP

✓ Eliminates the need to assign IP addresses to each device manually

✓ Each device gets unique IP address

DHCP

Copyright © Thinknyx Technologies LLP


DHCP
➢ Checking IP Configuration
✓ ip a ✓ Interface
- IP address (inet) - enx0
- MAC address - wlan0
- Configuration information

Copyright © Thinknyx Technologies LLP


DHCP
➢ Important Components of DHCP
✓ DHCP Server – Assigns IP addresses and network configurations to clients

✓ DHCP Client – Device that requests an IP address from the DHCP server

✓ IP Address Pool – Range of available IP addresses that DHCP server can allocate to clients

✓ Lease Time – Duration for which an IP address is assigned to client before it needs renewal

Copyright © Thinknyx Technologies LLP


DHCP
➢ Systemd-networkd
✓ System service used to manage network configurations on Linux systems

✓ Handles network interfaces, automatically assign IP addresses via DHCP

➢ Netplan
✓ Default tool used for network configuration on Ubuntu 24.04 and later

✓ Define network settings using YAML configuration files

✓ Works alongside systemd-networkd

✓ Network setting - /etc/netplan/

Copyright © Thinknyx Technologies LLP


DHCP
➢ Why use dhclient?
✓ Manually request, release, or renew IP addresses
✓ Useful in troubleshooting, demonstrations, configuring network interfaces manually

Copyright © Thinknyx Technologies LLP


Summary

❖ SSH (Secure Shell)


❖ SSH client-server model and key-based authentication
❖ sshd daemon
❖ Key configuration files - sshd_config and authorized_keys
❖ Demonstration - setting up password and key-based authentication
❖ DHCP

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 17
Linux | Introduction to System
Management

Copyright © Thinknyx Technologies LLP


System Management

➢ System Management and its key concepts


- Scheduler
- Logging Mechanisms
- Alerting Systems
- Memory Management

Copyright © Thinknyx Technologies LLP


Linux | Scheduler

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Scheduler

➢ Popular Tools

Cron Anacron

At Batch

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Cron
Command_to_Execute
✓ Time-based job scheduler * * * *
✓ Task known as ‘cron jobs’ *
✓ Crontab Day of the week (0-7)
- List of commands
Month (1-12)
- Execution time
Day of the Month (1-31)

Hour (0-23)

Minute (0-59)

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Understanding Cron's Special Strings

Special Strings Equivalent to Execution Result


@reboot - Executed once at system startup

@yearly or @annually 0011* Once a year at midnight on


January 1st
@monthly 001** Once a month at midnight on the
first day of the month
@weekly 00**0 Once a week at midnight on
Sunday
@daily or @midnight 00*** Once a day at midnight

@hourly 0**** Once an hour at the beginning of


the hour

Copyright © Thinknyx Technologies LLP


Scheduler
➢ For Example:

30 2 * * * ~/backup_script.sh

Understanding this structure allows you to schedule tasks with precision, ensuring they run exactly when needed
30th 2Applicable
AM
minute
Every Value

Copyright © Thinknyx Technologies LLP


Scheduler
✓ Manage and monitor scheduled jobs

crontab -l [To list current cronjob]

crontab -e [To edit cronjob]

crontab -r [To remove crontab]

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Anacron
✓ Systems that may not run 24/7
✓ Periodically running tasks
✓ System is turned off for some time

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Syntax
✓ /etc/anacrontab

PERIOD DELAY JOB-IDENTIFIER COMMAND

Frequency in days Unique name

Startup execution delay Command to execute

✓ NOTE: /etc/anacrontab is not found by default in ubuntu 24.04 LTS

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Installation
✓ sudo apt install anacron
✓ cat /etc/anacrontab

Copyright © Thinknyx Technologies LLP


Scheduler
✓ /etc/anacrontab

1 5 log-cleanup find /root/scripts/logs -type f -name "*.log" -mtime +7 -exec rm {} \;

✓ Anacron doesn't provide direct commands

✓ Manage by editing the /etc/anacrontab file

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Listing & Deleting Jobs

✓ sudo nano /etc/anacrontab

➢ Use Case

✓ Periodic maintenance tasks


- System Backups
- System Updates

Copyright © Thinknyx Technologies LLP


Scheduler
➢ AT
✓ Schedule a one-time task to run at a specific time

➢ Syntax
at TIME [Time – specifies when the command should run]

➢ Related Commands

Commands Execution Result


atq List Scheduled Jobs

atrm [job_number] Remove Scheduled Jobs


or
at -r [job_number]

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Batch
✓ Schedules tasks when the system load is low

➢ Syntax - BATCH

➢ For Example - cleanup_script1.sh located in /root/scripts/cleanup_script1.sh

Copyright © Thinknyx Technologies LLP


Scheduler
➢ Listing & Deleting Scheduled Batch Jobs

atrm [job_id] ---- Deleting the scheduled batch jobs

➢ Use Case
✓ Data Backup
✓ System Updates
✓ Resource-Intensive Calculations

Copyright © Thinknyx Technologies LLP


Demonstration | Scheduler

Copyright © Thinknyx Technologies LLP


Linux | Logging

Copyright © Thinknyx Technologies LLP


Logging

syslogd (rsyslog) logger

login logs journalctl

log rotation

Copyright © Thinknyx Technologies LLP


Logging
➢ syslogd / rsyslog used for System Logging

✓ Higher performance

✓ More filtering options

✓ Support for various protocols (TCP, UDP, TLS)

✓ Ability to write logs to databases, files, and remote servers

Copyright © Thinknyx Technologies LLP


Logging
➢ logger – Manually Logging Messages

/var/log/syslog

➢ For Example:
logger "Custom log message from thinknyx user"

❑ Some of the common usecases are:

✓ Log a message to syslog

✓ Log messages with a specific tag

✓ Input from command line and log to the syslog

✓ Assigning priorities to custom log messages

Copyright © Thinknyx Technologies LLP


Logging
➢ Login Logs – User Authentication Tracking

✓ Enhanced Security: Ensures that only authorized users access the Linux environment
✓ Comprehensive Activity Records: Logs detailed user actions such as login attempts and sudo usage

✓ Early Threat Detection: Helps administrators quickly spot unauthorized access and potential breaches
✓ Regulatory Compliance: Supports adherence to organizational policies and industry standards

Copyright © Thinknyx Technologies LLP


Logging
➢ Key Authentication Log Files:

/var/log/auth.log

❑ Command

sudo less /var/log/auth.log

❑ Reviewing Recent Logins

✓ The last command reads from the /var/log/wtmp file


✓ Such as username, terminal used, IP address or hostname of
the remote host, and login/logout times

❑ Reviewing Recent Logins

✓ The lastb command reads from the /var/log/btmp file

Copyright © Thinknyx Technologies LLP


Logging
➢ Real-Time Monitoring:

sudo tail -f /var/log/auth.log

Copyright © Thinknyx Technologies LLP


Logging
➢ Real-Time Monitoring:

✓ Timestamp: Indicates the date and time when the event occurred

✓ Hostname: The name of the host or server where the event was logged

✓ Service or Program Name: Identifies the service or application that generated the log entry

✓ Process ID (PID): The unique identifier of the process that logged the event

✓ Message Content: Provides detailed information about the event

✓ Module: Refers to the Pluggable Authentication Module (PAM) used

✓ Service Context: Specifies the service and the type of PAM interaction (session)

✓ Description: Indicates that a session for the user root has ended

Copyright © Thinknyx Technologies LLP


Logging
➢ journalctl – Systemd Journal Logs

✓ journalctl is used to view logs managed by systemd in Ubuntu 24.04 LTS

❑ Basic Usage

▪ View All Logs

o journalctl

▪ View Logs in Real-Time

o journalctl -f

▪ View Boot Logs

o journalctl -b

Copyright © Thinknyx Technologies LLP


Logging
➢ journalctl – Systemd Journal Logs

o journalctl –xe

✓ The journalctl -xe command in Linux is used to view detailed system logs and
troubleshoot errors

❑ The option
o -x → Provides extra details and explanations for log messages (if available)
o -e → Jumps to the end of the log, showing the most recent entries first
❑ This command
✓ Helps diagnose system errors and failures.
✓ Provides detailed explanations of logs.
✓ Useful for troubleshooting service failures and security alerts

Copyright © Thinknyx Technologies LLP


Linux | Alerting

Copyright © Thinknyx Technologies LLP


Alerting
✓ Alerting is essential for monitoring system health, security, and performance

✓ Such as high CPU usage, low disk space, or service failures

✓ System logs or specific conditions like resource thresholds

➢ Linux provides tools for alerting

▪ cron jobs – Schedule checks and trigger alerts


▪ mail or sendmail – Send email notifications for critical events

Copyright © Thinknyx Technologies LLP


Linux | Memory Management

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Memory management is a fundamental aspect of the Linux operating system, ensuring efficient
utilization of system resources and maintaining optimal performance

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Virtual Memory
✓ Virtual memory is a technique that allows a computer to use its hard disk to extend its RAM

Less used data Hard Disk

Virtual
RAM Memory

Data needed
by the CPU

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Linux provides:

✓ Process with its own virtual address space

✓ Large, contiguous memory area

✓ The kernel to manage mapping between virtual addresses and physical memory

✓ Efficient memory utilization and process isolation

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Paging

✓ Memory is divided into fixed-size blocks called pages

Logical Physical
Address address

1000
CPU Physical
P d f d Memory
RAM
1111..11

P
f

Page table

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Swap space

✓ Refers to an area on storage device that Linux OS uses as an extension of system's physical RAM

Operating
System

Swapped Out Process-1


User Space

Swapped In Process-2

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Page Cache

✓ Linux uses a page cache to store frequently accessed disk data in memory

User space Kernel space

Disk
Data Physical cache Disk
array Page
Logical Cache

Library
buffer

Stack

Library

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Memory Zones

✓ Kernel organizes physical memory into zones to optimize allocation


✓ ZONE_DMA
✓ ZONE_NORMAL
✓ ZONE_HIGHMEM

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Slab Allocator

✓ Maintains caches of commonly used objects, allowing for quick allocation and deallocation
✓ Reduces fragmentation and improves allocation efficiency

Copyright © Thinknyx Technologies LLP


Memory Management
➢ Overcommit Handling

✓ Linux allows processes to allocate more memory than physically available


✓ Kernel uses overcommit, to balance the need for memory allocation with the risk of running out of memory

Copyright © Thinknyx Technologies LLP


Memory Management
➢ NUMA (Non-Uniform Memory Access)

✓ Supports Multi processor system


✓ In Linux kernel optimizes memory allocation to minimize latency
✓ Improves performance by allocating memory on the same node
✓ Reduces the need for cross-node memory access

Copyright © Thinknyx Technologies LLP


Summary

❖ Schedulers in linux like cron, at, anacron and batch


❖ Logging in linux
❖ /var/log/syslog file
❖ Logger command
❖ Memory management

Copyright © Thinknyx Technologies LLP


Thinknyx Technologies

Linux Course
Enhancing Strategy
Section - 18
Linux | Introduction to Monitoring

Copyright © Thinknyx Technologies LLP


Monitoring

➢ Monitoring
- Tracking
- Troubleshooting
- Optimal Performance

Copyright © Thinknyx Technologies LLP


Linux | Need of Monitoring in Linux

Copyright © Thinknyx Technologies LLP


Need of Monitoring in Linux
➢ Monitoring

✓ Maintaining health of linux system

➢ Importance of Monitoring

Monitoring

Copyright © Thinknyx Technologies LLP


Need of Monitoring in Linux
➢ Why Monitoring is Crucial?

CPU usage
Memory issues
Admin
Network congestion

Disk space

System Metrics Administrator

Copyright © Thinknyx Technologies LLP


Need of Monitoring in Linux
➢ Early Detection of Problems

Anomalies

Monitoring Tools Downtime User Experience

Copyright © Thinknyx Technologies LLP


Need of Monitoring in Linux
➢ Early Detection of Problems

✓ Real-Time Visibility
- Tools like top, htop, and iftop
- Quickly identify processes
✓ Resource Optimization
- Track and optimize system resources
- Make informed decisions
✓ Log Analysis
- Troubleshoot and analyze system health
- syslog or journalctl

Copyright © Thinknyx Technologies LLP


Need of Monitoring in Linux
➢ Early Detection of Problems

✓ Historical Data
- Store historical performance data
- Helps in capacity planning, peak load analysis, and long-term performance tracking

✓ Alerting and Automation


- Send alerts
- Email, SMS & automated responses
✓ Scalability and Distributed Monitoring
- Prometheus, Nagios, or Zabbix
- Track the health of multiple servers, databases, and services

Copyright © Thinknyx Technologies LLP


Need of Monitoring in Linux
➢ Early Detection of Problems

✓ Security Monitoring
- Track security events
- Early catch potential security breaches & rectification

Copyright © Thinknyx Technologies LLP


Linux | Monitoring tools in Linux

Copyright © Thinknyx Technologies LLP


Monitoring tools in Linux
➢ Popular monitoring tools available on Ubuntu 24.04 LTS:

✓ ntopng (ntop Next Generation) : A network monitoring tool that shows network traffic in real-
time.A modern, next-generation version of ntop with enhanced features
✓ free: Provides a quick overview of memory usage on the system

✓ vmstat: Displays information about processes, memory, paging, block IO, traps, and CPU activity

✓ iostat: Displays CPU and I/O statistics for devices

✓ watch: Executes the command periodically, showing output full screen

✓ iftop: Monitors network bandwidth and provides detailed information about network connections

Copyright © Thinknyx Technologies LLP


Demonstration | Popular Monitoring Tools

Copyright © Thinknyx Technologies LLP


Popular monitoring tools

1 KB = 1,000 bytes

1 kibibyte (KiB) = 1,024 bytes

Copyright © Thinknyx Technologies LLP


Linux | Advanced Monitoring tools

Copyright © Thinknyx Technologies LLP


Advanced Monitoring
tools
➢ sar and journalctl command

❑ sar
✓ sar (System Activity Reporter) is another command-line utility that is part of the sysstat package in Linux

- Collecting
- Reporting
- Saving system activity

Monitoring

Copyright © Thinknyx Technologies LLP


Advanced Monitoring tools

Real-time monitoring Historical data


sar
Customizable reporting Long-term trend analysis

Copyright © Thinknyx Technologies LLP


Advanced Monitoring
tools
➢ sar and journalctl command

❑ journalctl
✓ journalctl another powerful tool for querying and analyzing logs from systemd-based systems

✓ It’s useful for real-time monitoring and diagnostics

Copyright © Thinknyx Technologies LLP


Advanced Monitoring
tools Name Number Description
emerg 0 System is unusable

alert 1 Immediate action required

crit 2 Critical conditions

err 3 Error messages

warning 4 Warnings

notice 5 Significant but normal events

info 6 Informational logs

debug 7 Debugging messages

Copyright © Thinknyx Technologies LLP


Summary

❖ Importance of Monitoring - System performance & Issue detection


❖ Popular Monitoring Tools - Track system and Network performance
❖ Demonstration - Monitor real-time system metrics
❖ Overview of Advanced Monitoring Tools

Copyright © Thinknyx Technologies LLP


The Ultimate Linux Bootcamp for
DevOps, SRE and Cloud Engineers
(Hands-On)
User & Group File
System Monitoring Management Permissions

Process & Service Package


Management Management

Disk
Networking
SSH Configuration Partitioning

Copyright © Thinknyx Technologies LLP


Copyright © Thinknyx Technologies LLP
Follow us on:
@thinknyx

@thinknyx

@thinknyx-technologies

@thinknyx

@thinknyx-technologies

Copyright © Thinknyx Technologies LLP

You might also like