58 SECTIONS · 1664 TOPICS
Linux Roadmap
Understanding Linux System Architecture
- 1. Understanding Kernel vs User Space
- Example: System Call Flow
- 2. Understanding Linux File System Hierarchy
- Example: View file system hierarchy
- 3. Understanding System Processes
- Example: Process Management
- Process Lifecycle
- 4. Understanding Runlevels and Targets
- Example: Changing Runlevel
- Runlevel vs Target Mapping
- 5. Understanding Linux Boot Sequence
- Example: GRUB Configuration
- 6. Understanding Shell Types
- Example: Checking Current Shell
- Example: Switching Shells
- 7. Viewing System Information
- Example: Check system uptime and load average
- Example: View detailed system information
- Example: Display disk usage
- 8. Checking Distribution Version
- 9. Viewing Kernel Version
- Example: Check kernel version
- 10. Viewing System Uptime and Load Average
- Example: Using uptime command
Navigating the File System
- 1. Understanding Absolute vs Relative Paths
- Example: Using Absolute vs Relative Paths
- 2. Navigating Directories
- Example: Changing to a subdirectory
- 3. Displaying Current Directory
- Example: Using pwd command
- 4. Listing Directory Contents
- 5. Using Directory Stack
- Example: Managing Directory Stack
- 6. Viewing File Type
- Example: Using file command
- 7. Following Symbolic Links
- Example: Using readlink to resolve a symlink
- Example: Using realpath to get the absolute path of a symlink
- 8. Understanding Hidden Files
- Example: Listing Hidden Files
- Example: Creating a Hidden File
- 9. Using Tab Completion
- Example: Basic tab completion
- 10. Using Wildcards
- Example: Using wildcards to copy files
- Example: Using wildcards to list files recursively
Working with Files and Directories
- 1. Creating Files
- Example: Creating a new file with content
- Example: Using touch to create an empty file
- 2. Creating Directories
- 3. Copying Files and Directories
- Example: Copying a file with preserved attributes
- Example: Recursively copying a directory
- 4. Moving and Renaming
- 5. Removing Files and Directories
- Example: Remove a file
- Example: Remove a directory and its contents
- Example: Force remove a file with no confirmation
- Key Points
- 6. Creating Symbolic Links
- Example: Creating a symbolic link to a directory
- Example: Creating a symbolic link to a file
- 7. Creating Hard Links
- Example: Creating a Hard Link
- Key Points About Hard Links
- 8. Displaying File Contents
- Example: Using cat to view file contents
- Example: Using head to view first lines of a file
- Example: Using tail to follow log file changes
- 9. Following File Updates
- Example: Watching Log File Changes
- Example: Using inotifywait for File Changes
- 10. Counting Lines, Words, Characters
- Example: Using wc command
- Example: Counting lines only
- 11. Comparing Files
- Example: Using diff to compare files
- Example: Using cmp to compare files byte by byte
- 12. Finding File Differences
- Example: Comparing Files with Unified Output
- Key Points
Working with Text Editors
- 1. Using nano Editor
- Example: Editing a Configuration File
- 2. Using vim Editor
- Example: Basic vim workflow
- Example: Search and replace in vim
- 3. Understanding vim Modes
- Example: Switching Between Modes
- 4. Navigating in vim
- Example: Moving to line 10
- Example: Moving to column 5
- Example: Moving to next word
- 5. Editing in vim
- Example: Basic vim workflow
- Example: Search and replace in vim
- Example: Setting up vim for Python development
- 6. Searching and Replacing in vim
- Example: Replace all occurrences of a word
- Example: Replace with confirmation
- 7. Using vim Visual Mode
- Example: Selecting text in visual mode
- Example: Using visual mode to change text
- Workflow: Using visual mode to change text
- 8. Configuring vim
- Example: Basic vimrc configuration
- 9. Using Multiple Buffers in vim
- Example: Managing Multiple Buffers
- 10. Using emacs Editor
- Example: Basic Emacs Workflow
Managing File Permissions and Ownership
- 1. Understanding Permission Model
- Example: Permission Representation
- 2. Viewing Permissions
- 3. Changing Permissions with Symbolic Mode
- Example: Adding Read Permission to Owner
- 4. Changing Permissions with Octal Mode
- Example: Setting Permissions to 755
- 5. Changing Ownership
- Example: Changing Ownership to Root
- 6. Changing Group Ownership
- Example: Changing Group Ownership
- 7. Setting Default Permissions
- Setting umask
- Example: Setting umask to 077
- 8. Applying Permissions Recursively
- Example: Recursive Permission Change
- 9. Setting Special Permissions
- Example: Setting SUID on passwd
- 10. Using Access Control Lists
- Example: Adding User to ACL
- 11. Understanding File Attributes
- Example: Setting Immutable Attribute
Understanding Inodes and File System Internals
- 1. Understanding Inode Structure
- Example: Inspecting Inode Details
- 2. Viewing Inode Information
- Example: Using stat to view inode details
- 3. Checking Inode Usage
- Example: Find files using a specific inode number
- 4. Understanding Hard Links vs Inodes
- Example: Creating and Using Hard Links
- 5. Finding Files by Inode Number
- Example: Find file by inode number in a directory
- 6. Understanding File Descriptors
- Example: Opening a File Descriptor
- Example: Redirecting File Descriptors
- 7. Viewing Open File Descriptors
- Example: Using lsof to view open files
- Example: Inspecting file descriptors in /proc
- 8. Understanding Sparse Files
- Example: Creating a Sparse File
- Example: Checking File Size and Disk Usage
- Key Points About Sparse Files
- 9. Managing Extended Attributes
- Example: Setting and Retrieving Extended Attributes
- 10. Understanding File System Journaling
- Example: Enabling Journaling on ext4
- Key Points About Journaling
Searching and Finding Files
- 1. Finding Files by Name
- Example: Find files with a specific extension
- Example: Find files with a specific name pattern
- 2. Finding by Type
- Example: Find all .txt files in the home directory
- Example: Find all directories named "backup"
- 3. Finding by Size
- Example: Find files larger than 50MB
- Example: Find files smaller than 1KB
- Example: Find files exactly 100MB
- 4. Finding by Modification Time
- Example: Find files modified in the last 24 hours
- Example: Find files modified more than 7 days ago
- Example: Find files modified exactly 5 minutes ago
- 5. Finding by Permissions
- Example: Find files with read permission for owner
- Example: Find files with execute permission for group
- Example: Find directories with no write permission for others
- 6. Executing Commands on Results
- Example: Execute command on all .txt files
- Example: Rename all .log files to .old
- 7. Using locate Command
- Example: Find all files named 'config.json'
- Example: Case-insensitive search for 'readme'
- 8. Finding Executables with which
- Example: Finding executable location
- Example: Using
- 9. Finding Files with whereis
- Example: Find all files related to 'ls'
- Summary of whereis Options
- 10. Searching File Contents
- Example: Using grep to find lines matching a pattern
- Example: Using ripgrep to search recursively in a directory
- 11. Combining Find Conditions
- Example: Complex Find with Multiple Conditions
Processing Text with grep
- 1. Searching with Basic Patterns
- Example: Basic Pattern Search
- Example: Start of Line Match
- 2. Case-Insensitive Search
- Example: Case-Insensitive Search
- 3. Recursive Search
- Example: Recursive search in a directory
- Example: Recursive search with file type filter
- 4. Showing Line Numbers
- Example: Display line numbers for matches
- 5. Counting Matches
- Example: Counting Matches in a File
- Example: Counting Non-Matching Lines
- 6. Inverting Match
- Example: Inverting Match with grep
- 7. Matching Whole Words
- Example: Matching whole words
- 8. Searching with Context
- Example: Show 2 lines before and after each match
- Example: Show 3 lines after each match
- 9. Using Extended Regex
- Example: Matching IP Addresses
- Example: Using Groups for Capture
- 10. Using Perl-Compatible Regex
- Example: Using PCRE to match word boundaries
- Example: Using PCRE to match multiline patterns
- 11. Listing Only Filenames
- Example: Using -l to list filenames
- 12. Matching Multiple Patterns
Processing Text with sed
- 1. Understanding sed Syntax
- Example: Basic substitution
- Example: In-place editing
- 2. Substituting Text
- 3. Editing Files In-Place
- Example: In-place replacement with backup
- 4. Deleting Lines with Patterns
- 5. Inserting Lines
- 6. Using Address Ranges
- Example: Using Address Ranges to Replace Text in a Range
- Example: Using Address Ranges with Regular Expressions
- 7. Using Multiple Commands
- Example: Chaining sed commands
- Workflow: Applying multiple sed commands
- 8. Using sed Scripts
- Example: Basic sed script to replace text
- Example: sed script with multiple commands
- 9. Printing Specific Lines
- 10. Using Regular Expressions
- Example: Matching and Replacing
- Example: Using Groups
Processing Text with awk
- 1. Understanding awk Syntax
- Example: Basic awk usage
- Example: Field manipulation
- 2. Using Field Separator
- Example: Using colon as field separator
- 3. Printing Specific Fields
- Example: Print specific fields from a CSV file
- Example: Print last field of each line
- Example: Print fields 2 through 4
- 4. Using Patterns
- Example: Matching Lines with Regex
- Example: Using Field Patterns
- 5. Using Built-in Variables
- Example: Print line number and field count
- Example: Change field separator
- 6. Using BEGIN and END Blocks
- Example: Initializing Variables with BEGIN
- Example: Formatting Output with END
- 7. Performing Calculations
- Example: Summing Fields in a File
- Example: Using Built-in Functions
- 8. Using Conditional Statements
- Example: Conditional Processing of Fields
- 9. Using awk Functions
- 10. Formatting Output
- Example: Basic Formatting with printf
- Example: Floating Point Formatting
Working with Text Manipulation Tools
- 1. Sorting Lines
- 2. Sorting by Field
- Example: Sort by field
- Example: Sort numerically by field
- 3. Removing Duplicate Lines
- Example: Remove duplicate lines from a log file
- 4. Cutting Columns
- Example: Extracting Fields from a CSV File
- Example: Extracting Fields from a Log File
- 5. Pasting Files Side by Side
- 6. Translating Characters
- Example: Translate lowercase vowels to uppercase
- Example: Delete specific characters
- Example: Complement translation
- 7. Joining Files
- Example: Using cat to join files
- Example: Using paste to merge files side-by-side
- Example: Using join to merge files on a common field
- 8. Splitting Files
- Example: Splitting a Large File into 10MB Chunks
- Example: Splitting a Log File into 1000-Line Segments
- 9. Reversing Lines
- 10. Formatting Text
Working with Regular Expressions
- 1. Understanding Basic Regex Syntax
- Example: Basic Pattern Matching
- Example: Using Character Classes
- Example: Quantifier Usage
- 2. Using Character Classes
- Example: Matching a Date Format
- Example: Validating Email Username
- 3. Using Quantifiers
- Example: Matching phone numbers
- Example: Matching repeated words
- 4. Using Anchors
- Example: Using Anchors in grep
- Example: Word Boundary Matching
- 5. Using Groups and Capturing
- Example: Extracting Date Components
- Example: Reformatting Phone Numbers
- 6. Using Extended Regex
- Example: Using Extended Regex in Grep
- Example: Matching Multiple Patterns
- Example: Using Quantifiers
- 7. Using Perl-Compatible Regex
- Example: Matching with PCRE
- Example: Using Lookahead
- 8. Using Lookahead and Lookbehind
- Example: Positive Lookahead for Password Validation
- Example: Positive Lookbehind for Currency Parsing
- 9. Using Non-Capturing Groups
- Example: Using Non-Capturing Groups in Replace Operations
- 10. Testing Regex Patterns
- Example: Using grep with regex
- Example: Using sed to replace matches
- Example: Using Lookahead
- 8. Using Lookahead and Lookbehind
- Example: Positive Lookahead for Password Validation
- Example: Positive Lookbehind for Currency Parsing
- 9. Using Non-Capturing Groups
- Example: Using Non-Capturing Groups in Replace Operations
- 10. Testing Regex Patterns
- Example: Using grep with regex
- Example: Using sed to replace matches
- Example: Using sed to replace matches
- Example: Using Lookahead
- 8. Using Lookahead and Lookbehind
- Example: Positive Lookahead for Password Validation
- Example: Positive Lookbehind for Currency Parsing
- 9. Using Non-Capturing Groups
- Example: Using Non-Capturing Groups in Replace Operations
- 10. Testing Regex Patterns
- Example: Using grep with regex
- Example: Using sed to replace matches
Working with Input and Output Redirection
- 1. Redirecting Standard Output
- Example: Redirecting Output to a File
- Example: Appending Output to a Log File
- 2. Redirecting Standard Error
- Example: Redirecting Errors to a Log File
- Example: Merging Standard Output and Error
- 3. Redirecting Both Stdout and Stderr
- Example: Redirecting both stdout and stderr to a file
- Example: Redirecting both streams to /dev/null
- 4. Redirecting Input
- Example: Using input redirection with sort
- Example: Using here document for input
- 5. Using Here Documents
- Example: Writing a multi-line message to a file
- Example: Using here document with a script
- 6. Using Here Strings
- Example: Using Here Strings with grep
- Example: Discarding Both Standard Output and Error
- 8. Reading from Files
- Example: Reading specific lines from a file
- 9. Writing to Files
- Example: Overwriting a file with command output
- Example: Appending to a log file
- 10. Appending to Files
- Example: Appending to a Log File
Using Pipes and Command Chaining
- 1. Piping Commands
- Example: Filtering Log Files
- 2. Using tee for Splitting Output
- Example: Splitting Output to File and Terminal
- Example: Appending to a File with tee
- 3. Chaining with AND Operator
- Example: Using && to conditionally execute commands
- 4. Chaining with OR Operator
- Example: Using || to provide a fallback
- 5. Running Commands Sequentially
- Example: Chaining with && and ||
- 6. Using Command Substitution
- Example: Using command substitution to get current directory size
- Example: Combining command substitution with other commands
- 7. Process Substitution
- Example: Comparing Directory Contents
- Example: Using with
- 8. Using xargs for Command Building
- Example: Using xargs to process files
- Example: Using xargs with -I to rename files
- Example: Using xargs with -0 for null-separated input
- 9. Parallel Command Execution
- Example: Running Multiple Commands in Parallel
- Key Points
- 10. Grouping Commands
- Example: Using braces to group commands
Compressing and Archiving Files
- 1. Creating tar Archives
- Example: Creating a tar archive
- Example: Creating a compressed tar archive
- 2. Extracting tar Archives
- 3. Listing tar Contents
- Example: List contents of a tar archive
- Example: List contents excluding log files
- 4. Compressing with gzip
- Common gzip Options
- 5. Compressing with bzip2
- Example: Compressing a file with bzip2
- Example: Decompressing a file with bunzip2
- 6. Compressing with xz
- Example: Compressing a file with xz
- Example: Compressing with maximum compression
- 7. Creating zip Archives
- Example: Creating a compressed archive with maximum compression
- Example: Creating a zip archive recursively from a directory
- 8. Extracting zip Archives
- 9. Using 7-Zip
- Example: Create a password-protected archive
- Example: Create archive with compression level
- 10. Compressing with zstd
- Example: Compressing a directory with zstd
Managing Environment Variables
- 1. Viewing All Variables
- Example: Using
- Example: Using
- 2. Displaying Specific Variable
- 3. Setting Temporary Variables
- Example: Setting and Using a Temporary Variable
- 4. Unsetting Variables
- Example: Unsetting a Variable
- 5. Setting Permanent Variables
- Example: Adding a variable to ~/.bashrc
- 6. Setting System-Wide Variables
- Example: Adding a system-wide variable
- 7. Managing PATH Variable
- Example: Adding a Custom Binary Directory to PATH
- 8. Using Variable Substitution
- Example: Variable Substitution in Shell Script
- 9. Setting Variables in Scripts
- Example: Setting and Using Variables in a Script
- 10. Exporting Variables to Child Processes
- Example: Setting and Exporting a Variable
- Example: Running Command with Temporary Variable
Configuring Shell Environment
- 1. Understanding Shell Configuration Files
- Example: Setting Environment Variables in ~/.bashrc
- 2. Setting Shell Prompt
- Example: Customizing PS1
- Example: Colorized Prompt
- 3. Creating Command Aliases
- Example: Define alias in .bashrc
- 4. Defining Shell Functions
- Example: Defining and Using a Bash Function
- Example: Function with Parameters and Return Value
- 5. Configuring Command History
- Example: Setting History Size
- Example: Ignoring Duplicate Commands
- Example: Adding Timestamps to History
- 6. Using History Command
- Example: Using history command
- Example: Re-executing last command
- 7. Searching Command History
- Example: Using history command
- Example: Re-executing last command with !!
- Example: Using !string to re-execute command
- 8. Configuring Auto-Completion
- Example: Bash Auto-Completion Setup
- Example: Zsh Auto-Completion Setup
- 9. Setting Default Editor
- Example: Setting Default Editor for Git
- 10. Changing Default Shell
- Example: Using chsh to change shell
- 11. Using Shell Options
- Example: Enabling Debug Mode
Writing Bash Scripts
- 1. Creating Script File
- Example: Basic Bash Script File
- 2. Making Scripts Executable
- Example: Basic Executable Script
- 3. Using Variables
- Example: Variable Assignment and Usage
- Example: Exporting Variables
- 4. Reading User Input
- 5. Using Command-Line Arguments
- Example: Accessing Arguments
- Example: Looping Through Arguments
- Example: Handling Optional Arguments
- 6. Implementing Conditional Statements
- Example: Basic if-else
- Example: Nested if-else
- Example: Using test command
- 7. Using Test Conditions
- Example: Using test conditions in an if statement
- Example: Combining test conditions with logical operators
- 8. Implementing Loops
- Example: Looping Through Files
- Example: Nested Loops
- 9. Using Case Statements
- Example: Basic Case Statement
- 10. Defining Functions
- Example: Basic Function Definition
- Example: Function with Parameters
- Example: Function with Local Variables
- 11. Handling Exit Codes
- Example: Using exit codes in a script
- Example: Checking exit code of a command
- 12. Implementing Error Handling
- Example: Using set options
- Example: Trap usage
- Example: Function error handling
Working with Advanced Bash Features
- 1. Using Arrays
- Example: Array Declaration and Access
- Example: Array Length and Append
- 2. Using Associative Arrays
- Example: Using Associative Arrays for Configuration
- 3. Using String Operations
- Example: Extracting filename and extension
- Example: Replacing multiple occurrences
- Common String Operations Summary
- 4. Using Arithmetic Expansion
- 5. Implementing Signal Handling
- Example: Catching SIGINT in Bash
- Example: Handling SIGHUP to Reload Config
- 6. Using Process Substitution
- Example: Comparing Directory Contents
- Example: Redirecting to a Command
- 7. Creating Subshells
- Example: Variable Scope Isolation
- Key Points
- 8. Using set Options
- Example: Enabling set options
- 9. Debugging Scripts
- Example: Using set -x to debug a script
- Example: Using set -e to exit on error
- 10. Using getopts for Options
- Example: Basic getopts usage
Understanding Linux Signals
- 1. Viewing Available Signals
- Example: List all available signals using kill -l
- 2. Sending Signals with kill
- Example: Sending SIGTERM to a process by PID
- Example: Sending SIGKILL to a process by name
- 3. Understanding Common Signals
- Example: Sending a Signal to a Process
- 4. Understanding SIGINT and SIGQUIT
- Example: Handling SIGINT in a Bash Script
- Example: Sending SIGINT to a Process
- 5. Handling SIGHUP for Daemons
- Example: Reopening Log Files on SIGHUP
- 6. Using SIGUSR1 and SIGUSR2
- Example: Sending SIGUSR1 to a Process
- Example: Handling SIGUSR1 in a Bash Script
- 7. Understanding SIGSTOP and SIGCONT
- Example: Using SIGSTOP and SIGCONT
- Key Points
- 8. Trapping Signals in Scripts
- Example: Basic Signal Trapping
- Example: Handling SIGUSR1
- 9. Ignoring Signals
- Example: Ignoring SIGPIPE in Bash
- Example: Ignoring SIGALRM in C
- 10. Understanding Signal Propagation
- Example: Signal propagation in a parent-child process
Managing Users and Groups
- 1. Creating Users
- Example: Create a user with a specific home directory
- Example: Create a user and set a password
- 2. Modifying User Accounts
- Example: Changing User Home Directory
- Example: Adding User to Group
- 3. Deleting Users
- Example: Delete a user without removing home directory
- Example: Delete a user and remove home directory
- 4. Setting User Passwords
- Example: Setting a new password for a user
- Example: Locking a user account
- Example: Configure password aging policy
- Password Security Best Practices
- 5. Creating Groups
- Example: Creating a Group with a Specific GID
- Example: Creating a System Group
- 6. Modifying Groups
- Example: Change Group Name
- Example: Change Group ID
- 7. Deleting Groups
- Example: Delete a group
- 8. Adding Users to Groups
- Example: Adding User to Multiple Groups
- 9. Removing Users from Groups
- Example: Remove user from a group
- 10. Viewing User Information
- Example: Viewing User Info with id
- Example: Viewing User Info with finger
- 11. Switching Users
- Example: Switching to another user
- Example: Running a command as root
- 12. Managing Sudo Access
- Example: Granting Sudo Access to a User
- Example: Restricting Sudo Access
Managing Processes
- 1. Viewing Running Processes
- Example: Using ps aux to view processes
- Example: Using top to monitor processes
- 2. Displaying Process Tree
- Example: pstree with process IDs
- Example: ps auxf format
- 3. Monitoring Processes in Real-Time
- Example: Using htop to monitor processes
- Example: Watching process CPU usage every second
- Key Features of Process Monitoring Tools
- 4. Using Enhanced Process Viewer
- Example: Viewing process details with
- Key Features of htop
- 5. Killing Processes by PID
- Example: Killing a Process by PID
- 6. Killing Processes by Name
- Example: Killing a Process by Name
- 7. Sending Signals to Processes
- Example: Sending a signal to a process
- Example: Using pkill to send signal by name
- 8. Viewing Process Priority
- Example: Check process priority using ps command
- Example: View priority of a specific process
- 9. Changing Process Priority
- Example: Setting Process Priority with nice
- Example: Adjusting Priority of Running Process with renice
- 10. Running Commands in Background
- Example: Running a long process in background
- 11. Bringing Processes to Foreground
- Example: Bringing a background job to foreground
- 12. Listing Background Jobs
- Example: Using jobs command
Working with Job Control
- 1. Running Background Jobs
- Example: Starting a Background Job
- Example: Resuming a Stopped Job in Background
- 2. Suspending Foreground Jobs
- Example: Suspending and Resuming a Job
- 3. Listing Jobs
- Example: Using jobs command
- 4. Resuming Jobs in Foreground
- Example: Resuming a Background Job
- 5. Resuming Jobs in Background
- Example: Resuming a suspended job in background
- 6. Using nohup for Persistent Processes
- Example: Running a Script with nohup
- 8. Using screen for Terminal Multiplexing
- Example: Starting and Managing a Screen Session
- Common Screen Key Bindings
- 9. Managing screen Sessions
- Example: Starting a screen session
- Example: Attaching to a screen session
- Common screen Session Management Commands
- 10. Using tmux for Terminal Multiplexing
- Example: Creating and Managing a tmux Session
- Common tmux Use Cases
- 11. Managing tmux Sessions
- Example: Creating and Attaching to a Session
- Example: Listing and Killing Sessions
- 12. Using tmux Panes and Windows
- Example: Creating a new tmux window
- Example: Splitting panes horizontally
- Example: Navigating between panes
- Key tmux Window and Pane Commands
Managing Services with systemd
- 1. Starting Services
- Example: Starting a service
- 2. Stopping Services
- Example: Stopping a service
- Example: Disabling a service at boot
- 3. Restarting Services
- Example: Restarting a service
- Example: Conditionally restarting a service
- 4. Reloading Configuration
- Example: Reloading a Web Server Configuration
- 5. Checking Service Status
- 6. Enabling Services at Boot
- Example: Enable a service at boot
- Example: Check if a service is enabled
- 7. Disabling Services
- Example: Disabling a Service
- 8. Listing All Services
- Example: Listing all running services
- Example: Listing all service unit files
- 9. Viewing Service Dependencies
- Example: View service dependencies
- Example: View reverse dependencies
- 10. Masking Services
- Example: Masking a service
- Example: Unmasking a service
- 11. Creating Custom Service Units
- Example: Basic Service Unit
- Example: Service with Environment Variables
- 12. Reloading systemd Configuration
- Example: Reloading systemd configuration
Scheduling Tasks with Cron
- 1. Editing Crontab
- Example: Adding a Cron Job
- 2. Listing Cron Jobs
- Example: Listing Cron Jobs for Current User
- 3. Removing Crontab
- 4. Understanding Cron Syntax
- Example: Cron Expression Breakdown
- Example: Running a Script Every Hour at 15 Minutes
- Example: Weekly Backup on Sundays at 2 AM
- 5. Using Special Time Strings
- Example: Using @daily
- Example: Using @reboot
- 6. Managing System Cron
- Example: Check Cron Service Status
- Example: Enable Cron to Start on Boot
- 7. Using Cron Directories
- Example: Creating a Daily Cron Job
- 8. Viewing Cron Logs
- Example: Check cron logs for recent entries
- Example: Enable detailed cron logging (syslog)
- 9. Scheduling with anacron
- Example: Basic anacron job
- 10. Using at for One-Time Tasks
- Example: Schedule a One-Time Task
- 11. Scheduling with systemd Timers
- Example: Basic systemd timer configuration
Working with Package Management (Debian/Ubuntu)
- 1. Updating Package Lists
- Example: Updating package lists and checking for upgrades
- 2. Upgrading Packages
- Example: Upgrade all packages
- 3. Installing Packages
- Example: Installing a package with dependencies
- Installation Summary
- 4. Removing Packages
- Example: Removing a Package
- Example: Purging a Package
- 5. Searching for Packages
- Example: Search for packages containing "mysql"
- 6. Showing Package Information
- Example: Displaying package info with apt show
- Example: Listing installed packages
- 7. Listing Installed Packages
- Example: Using dpkg to list installed packages
- Example: Using apt list to show installed packages
- 8. Cleaning Package Cache
- Example: Cleaning Package Cache
- 9. Managing Repositories
- Example: Adding a Repository
- Example: Removing a Repository
- Workflow: Adding a Third-Party Repository
- 10. Installing DEB Packages
- Example: Installing a local DEB package
- 11. Resolving Dependencies
- Example: Resolving Dependency Conflicts
- 12. Holding Package Versions
- Example: Holding a Package Version
Working with Package Management (RHEL/CentOS)
- 1. Checking for Updates
- Example: Checking for updates for a specific package
- 2. Upgrading Packages
- Example: Update a specific package
- Example: Update all packages with security fixes
- 3. Installing Packages
- Example: Install Apache Web Server
- 4. Removing Packages
- Example: Removing a Package with YUM
- Example: Removing a Package with DNF
- 5. Searching for Packages
- Example: Search for packages containing "node"
- Example: Search all package metadata for "mysql"
- 6. Showing Package Information
- Example: Displaying package information
- Example: Listing files in a package
- Example: Finding package owner of a file
- 7. Listing Installed Packages
- Example: Find all packages related to Python
- 8. Cleaning Package Cache
- Example: Cleaning package cache
- 9. Managing Repositories
- Example: Adding a Custom Repository
- Workflow: Enable a Repository
- Comparison: YUM vs DNF
- 10. Installing RPM Packages
- Example: Installing a Package
- 11. Querying RPM Packages
- Example: Find package that owns a file
- Example: List all files in a package
- 12. Verifying Package Integrity
- Example: Verifying Package Integrity
- Example: Checking Package Signature
Managing System Logs with journald
- 1. Viewing System Logs
- Example: View logs for the nginx service
- Example: View logs from the last hour
- Example: Follow logs in real-time with priority filter
- 2. Following Logs in Real-Time
- Example: Following Logs in Real-Time
- Example: Following Logs from a Service
- Example: Following Logs from a Specific Time
- 3. Filtering by Service
- Example: Filter logs for a specific service
- 4. Filtering by Time Range
- Example: Filtering logs from the last 15 minutes
- Example: Filtering logs between two specific timestamps
- 5. Filtering by Priority
- Example: Filtering Logs by Priority Level
- Example: Combining Priority with Time Range
- 6. Viewing Boot Logs
- Example: View boot logs with timestamp
- 7. Viewing Logs for Specific PID
- Example: View logs for a specific PID
- Example: View logs for a specific PID with time range
- 8. Exporting Logs
- Example: Exporting logs to a file
- Example: Exporting logs with a time range
- 9. Configuring Journal Storage
- Example: Journal Storage Configuration
- 10. Clearing Journal Logs
- Example: Clearing Journal Logs by Size
- Example: Clearing Journal Logs by Time
- 11. Viewing Kernel Messages
- Example: View kernel messages from current boot
- Example: View kernel messages from last boot with timestamp
- Summary of Kernel Log Filtering Options
- 12. Searching Logs
- Example: Search logs from last hour
- Example: Search logs with specific message pattern
- Example: Search logs from a specific service
Managing Traditional System Logs
- 1. Understanding Syslog Architecture
- Example: Syslog Message Format
- Example: Basic rsyslog Configuration
- Key Concepts in Syslog Architecture
- 2. Reading Log Files
- Example: Viewing Log Files with
- Example: Filtering Logs by Timestamp
- Example: Using
- 3. Viewing Authentication Logs
- Example: Filter Failed Login Attempts
- Example: Monitor Real-Time Authentication Events
- 4. Viewing System Messages
- Example: Using journalctl to view recent logs
- Example: Filtering logs by service
- 5. Following Logs with tail
- Example: Following system logs in real-time
- Example: Following last 20 lines of a log file
- 6. Configuring rsyslog
- Example: Basic rsyslog configuration
- Example: Filtering logs by facility and priority
- 7. Rotating Logs
- Example: Basic logrotate configuration
- 8. Configuring Log Rotation
- Example: Basic logrotate configuration for a web server
- 9. Sending Logs to Remote Server
- Example: Configure rsyslog to send logs to remote server
- 10. Using logger Command
- Example: Logging a message with logger
Managing Disk Space
- 1. Viewing Disk Usage
- Example: Check disk usage of root directory
- Example: Find largest directories in home folder
- 2. Checking Directory Size
- Example: Check directory size
- Example: Check all subdirectories size
- 3. Analyzing Disk Usage
- Example: Check disk usage of current directory
- Example: Using ncdu for interactive disk usage analysis
- Common du options
- 4. Finding Large Files
- Example: Find files larger than 100MB
- Example: Find files larger than 1GB
- Example: Find files larger than 1GB and sort by size
- 5. Checking Inode Usage
- Example: Check inode usage on root filesystem
- 6. Viewing Block Devices
- Example: Using lsblk to view block devices
- Example: Using fdisk to view partition layout
- 7. Displaying Partition Table
- Example: Using lsblk to display partition table
- 8. Mounting File Systems
- Example: Mounting a USB Drive
- Example: Auto-mounting with /etc/fstab
- 9. Unmounting File Systems
- Example: Unmounting a USB Drive
- 10. Viewing Mounted File Systems
- Example: Check disk usage for a specific directory
- 11. Configuring Automatic Mounts
- Example: Adding a New Mount Point
- 12. Checking File System
- Example: Check disk usage of root directory
Managing Partitions and File Systems
- 1. Creating Partitions with fdisk
- Example: Create a new partition using fdisk
- 2. Creating Partitions with parted
- Example: Create a new partition table and add a partition
- 3. Creating GPT Partitions
- Example: Using gdisk to create a new GPT partition
- 4. Creating ext4 File System
- Example: Create ext4 File System
- 5. Creating XFS File System
- Example: Create XFS File System
- Key Features of XFS
- 6. Creating Btrfs File System
- Example: Create Btrfs File System
- 7. Creating FAT32 File System
- Example: Create FAT32 File System
- 8. Resizing ext File Systems
- Example: Resizing an ext4 filesystem to 10GB
- 9. Resizing XFS File Systems
- Example: Growing an XFS Filesystem
- Example: Checking XFS Filesystem Size
- Key Points
- 10. Tuning File System Parameters
- Example: Adjusting swappiness to reduce swapping
- Example: Setting maximum file handles system-wide
- 11. Checking File System Type
- Example: Identifying File System Type
- 12. Using Btrfs Subvolumes
- Example: Creating and Using Subvolumes
- Example: Creating a Snapshot
- Key Features of Btrfs Subvolumes
Managing Swap Space
- 1. Viewing Swap Usage
- Example: Check current swap usage with free
- Example: List all active swap spaces
- 2. Creating Swap Partition
- Example: Enabling Swap
- 3. Enabling Swap Partition
- Example: Enabling Swap Partition
- 4. Creating Swap File
- Example: Create a 1GB Swap File
- Example: Make Swap File Permanent
- 5. Setting Up Swap File
- Example: Verify Swap Activation
- Swap File Configuration Summary
- 6. Configuring Permanent Swap
- 7. Disabling Swap
- Example: Disable all swap spaces
- 8. Adjusting Swap Priority
- Example: Setting swappiness to 10
- Example: Making swappiness persistent across reboots
- 9. Tuning Swappiness
- Example: Setting Swappiness to 10
- Example: Making Swappiness Change Permanent
- 10. Monitoring Swap Activity
- Example: Check current swap usage
- Example: Monitor swap usage over time
Managing LVM Volumes
- 1. Understanding LVM Concepts
- Example: Creating a basic LVM setup
- Key Benefits of LVM
- 2. Creating Physical Volumes
- Example: Creating a Physical Volume
- 3. Viewing Physical Volumes
- Example: Using pvs command
- Example: Using pvs with verbose flag
- 4. Creating Volume Groups
- Example: Creating a Volume Group with Two Physical Volumes
- 5. Viewing Volume Groups
- Example: Displaying Volume Group Details
- 6. Extending Volume Groups
- Example: Extending Volume Group with New Disk
- 7. Creating Logical Volumes
- Example: Create a 5GB Logical Volume
- 8. Viewing Logical Volumes
- Example: View all logical volumes with full details
- 9. Extending Logical Volumes
- Example: Extend Logical Volume by Size
- Example: Extend Logical Volume to Use All Free Space
- Example: Extend XFS Filesystem After Extending LV
- Example: Extend ext4 Filesystem After Extending LV
- 10. Resizing File Systems
- Example: Resizing ext4 File System
- Example: Resizing XFS File System
- 11. Creating LVM Snapshots
- Example: Creating a Snapshot
- Snapshot Creation Steps
- 12. Removing LVM Components
- Example: Remove Logical Volume
- Workflow: Remove LVM Components Safely
Configuring RAID Arrays
- 1. Understanding RAID Levels
- 2. Creating RAID with mdadm
- Example: Create a RAID 1 Array
- RAID Level Summary
- 3. Viewing RAID Status
- Example: Check RAID status with mdadm
- Example: List all RAID arrays
- Example: Monitor RAID rebuild progress
- 4. Adding Disks to RAID
- Example: Adding a Disk to RAID 1 Array
- 5. Removing Failed Disks
- Example: Removing and Replacing a Disk
- 6. Stopping RAID Arrays
- Example: Stopping a RAID Array
- 7. Assembling RAID Arrays
- Example: Assemble a RAID 1 Array
- Example: Assemble with Configuration File
- Assembling Process Summary
- 8. Saving RAID Configuration
- Example: Save RAID configuration using mdadm
- 9. Monitoring RAID Health
- Example: Check RAID Status with mdadm
- Example: View RAID Events with journalctl
- Example: Monitor RAID with /proc/mdstat
- 10. Growing RAID Arrays
- Example: Adding a new drive to an existing RAID 5 array
Configuring Hostname and DNS
- 1. Viewing Hostname
- Example: Displaying Hostname
- 2. Setting Hostname
- Example: Setting Hostname with hostnamectl
- 3. Configuring Static Hostname
- Example: Setting Static Hostname Using hostnamectl
- Summary of Hostname Configuration Methods
- 4. Understanding hosts File
- Example: hosts file entry
- Key Points
- 5. Adding Local DNS Entries
- Example: Adding a local DNS entry for a development server
- 6. Configuring DNS Resolvers
- Example: Adding DNS Resolver
- 7. Understanding NSSwitch
- Example: NSSwitch Configuration
- 8. Using systemd-resolved
- Example: Basic systemd-resolved configuration
- Workflow: Setting up systemd-resolved
- 9. Configuring Search Domains
- Example: Setting Search Domains
- 10. Testing DNS Resolution
- Example: Using dig to query DNS records
- Example: Using nslookup to resolve a hostname
Configuring Network Interfaces
- 1. Viewing Network Interfaces
- Example: Displaying interface details with
- 2. Configuring IP Addresses
- Example: Assigning Static IP Address Using ip Command
- Example: Viewing Assigned IP Addresses
- 3. Enabling and Disabling Interfaces
- Example: Enabling an Interface
- Example: Disabling an Interface
- 4. Viewing Routing Table
- Example: Displaying routing table with ip route
- 5. Adding Static Routes
- Example: Adding a Static Route Using ip Command
- Example: Adding a Static Route Using route Command
- 6. Deleting Routes
- Example: Delete a specific route using ip command
- 7. Setting Default Gateway
- Example: Using ip command to set default gateway
- 8. Configuring DNS Servers
- Example: Setting DNS Servers via /etc/resolv.conf
- 9. Testing Network Connectivity
- Example: Check if a server is reachable
- Example: Diagnose network path issues
- Network Connectivity Testing Summary
- 10. Viewing Network Statistics
- Example: Monitor Network Traffic
- Example: Show Interface Statistics
- 11. Managing Network with NetworkManager
- Example: Configure a new Ethernet Connection
- Example: List All Active Connections
- 12. Configuring Network Bonds
- Example: Creating a Bond Interface
- Example: Bond Configuration in /etc/network/interfaces
Troubleshooting Network Issues
- 1. Tracing Network Path
- Example: Using traceroute to diagnose network path
- 2. Checking DNS Resolution
- Example: Using dig to check DNS resolution
- 3. Viewing Open Ports and Connections
- Example: Using ss to view listening ports with process info
- Example: Using netstat to view all TCP connections
- 4. Scanning Network Ports
- Example: Scan all ports on localhost using nmap
- Example: Check if port 22 is open using netcat
- 5. Testing TCP Connections
- Example: Using netcat to test TCP connection
- 6. Capturing Network Packets
- Example: Capture packets with tcpdump
- Example: Filter packets by protocol
- Example: Display packets in real-time
- 7. Analyzing Network Traffic
- Example: Capture HTTP traffic with tcpdump
- Example: Filter traffic by port using tshark
- 8. Checking Network Performance
- Example: Measuring Latency with ping
- Example: Monitoring Bandwidth with iftop
- 9. Displaying ARP Cache
- Example: Viewing ARP cache using ip neigh
- ARP Cache Status Values
- 10. Flushing DNS Cache
- Example: Flushing DNS Cache on Ubuntu 22.04
- 11. Diagnosing with curl and wget
- Example: Testing HTTP connectivity with curl
- Example: Using wget to test URL availability
Managing Firewall with iptables
- 1. Viewing iptables Rules
- 2. Understanding Chains
- Example: View Current Chains
- 3. Adding Rules
- 4. Deleting Rules
- Example: Delete a specific rule by number
- Example: Delete rule by matching criteria
- 5. Setting Default Policies
- Example: Setting Default Input Policy to DROP
- 6. Filtering by Source and Destination
- Example: Allow traffic from specific subnet to a server
- Example: Block traffic from specific IP to a service
- 7. Filtering by Port
- Example: Allow incoming connections on port 80
- Example: Block all traffic on port 2222
- 8. Filtering by Protocol
- Example: Allow TCP traffic on port 443
- Example: Drop UDP traffic on port 53
- 9. Using Connection Tracking
- Example: View Active Connections
- Example: Flush All Connections
- 10. NAT and Port Forwarding
- Example: Set up Port Forwarding
- 11. Saving iptables Rules
- Example: Save iptables rules to file
- 12. Logging Traffic
- Example: Log All Denied Packets
- Example: Log TCP Connections
Managing Firewall with ufw and firewalld
- 1. Viewing Firewall Status
- Example: Check ufw status
- Example: Check firewalld state
- 2. Enabling and Disabling Firewall
- Example: Enabling ufw firewall
- Example: Disabling ufw firewall
- Example: Checking ufw status
- Example: Reloading firewalld
- 3. Allowing Ports
- Example: Allow HTTP traffic
- Example: Allow SSH from a specific IP
- 4. Denying Ports
- Example: Deny incoming SSH access
- Example: Deny traffic from a specific IP
- 5. Allowing Services
- Example: Allow SSH service
- Example: Allow HTTP and HTTPS services
- Example: Allow specific port range (e.g., custom game server)
- 6. Deleting Rules
- Example: Delete a specific rule by position
- Example: Delete a rule by matching content
- 7. Configuring Default Policies
- Example: Setting Default Incoming Policy to Deny
- Example: Setting Default Outgoing Policy to Allow
- 8. Managing Zones
- Example: List available zones
- Example: Set default zone
- Example: Allow traffic from specific zone
- 9. Creating Rich Rules
- Example: Allow SSH from specific IP
- Example: Block traffic from a specific IP
- 10. Saving Firewall Rules
- Example: Save ufw rules to disk
- Example: Save firewalld runtime rules permanently
Working with SSH and Remote Access
- 1. Connecting to Remote Host
- Example: Basic SSH Connection
- Example: SSH with Custom Port
- Example: SSH with Specific Key
- 2. Using SSH with Custom Port
- Example: SSH Connection to Custom Port
- 3. Copying Files with SCP
- Example: Copying a file to a remote server
- Example: Copying a directory recursively
- 4. Synchronizing Files with rsync
- Example: Basic rsync command
- Example: Sync with delete
- Example: Dry run to preview changes
- 5. Generating SSH Keys
- Example: Generate RSA Key Pair
- Example: Generate Ed25519 Key Pair
- Key Generation Best Practices
- 6. Copying Public Key
- Example: Copying a public key to a remote server
- 7. Configuring SSH Client
- Example: Basic SSH Client Configuration
- Example: SSH Client with ProxyJump
- 8. Configuring SSH Server
- Example: Basic SSH Server Configuration
- Key SSH Server Configuration Options
- 9. Creating SSH Tunnels
- Example: Local Port Forwarding
- Example: Remote Port Forwarding
- Example: SOCKS Proxy
- 10. Managing SSH Agent
- Example: Start SSH Agent and Add Key
- 11. Using ProxyJump
- Example: SSH through a jump host
- Benefits of SSH Multiplexing
Working with Network File Systems
- 1. Installing NFS Server
- Example: Configure NFS Export
- 2. Configuring NFS Exports
- Example: /etc/exports configuration
- Example: Applying NFS exports
- 3. Exporting NFS Shares
- Example: Basic NFS Export Configuration
- Steps to Export an NFS Share
- 4. Mounting NFS Shares
- Example: Mounting an NFS Share
- Example: Mounting with Options
- 5. Configuring NFS Client
- Example: Mounting an NFS Share
- Example: Mounting with Specific Options
- 6. Installing Samba Server
- Example: Basic Samba Configuration
- 7. Configuring Samba Shares
- Example: Basic Samba Configuration
- Example: Setting Up Samba Share with User Authentication
- Workflow: Setting Up Samba Share
- 8. Creating Samba Users
- Example: Adding a new Samba user
- Example: Disabling a Samba user
- 9. Mounting CIFS Shares
- Example: Mounting a CIFS Share
- 10. Using autofs for Auto-Mounting
- Example: Basic autofs configuration
- Steps to set up autofs
- Key Features of autofs
Monitoring System Resources
- 1. Viewing Memory Usage
- Example: Using free -h to view memory usage
- Example: Using cat /proc/meminfo to view detailed memory info
- 2. Monitoring CPU Usage
- Example: Using
- Example: Using
- Example: Using
- 3. Displaying Load Average
- Example: Interpreting Load Average
- 4. Monitoring I/O Statistics
- Example: Using iostat to Monitor Disk I/O
- Example: Using iotop to Monitor I/O by Processes
- 5. Viewing Real-Time Disk Activity
- Example: Using iostat to view disk activity
- Example: Using iotop to view real-time I/O by process
- 6. Checking System Temperature
- Example: Using sensors command
- Example: Reading raw temperature values
- 7. Monitoring Network Bandwidth
- Example: Using iftop to monitor bandwidth
- Example: Using nethogs to view per-process bandwidth
- Key Features of Network Monitoring Tools
- 8. Using System Activity Reporter
- Example: Basic system activity report
- Example: Monitor disk I/O every 2 seconds for 3 times
- Example: Display network statistics
- 9. Viewing System Statistics
- Example: Using top to monitor CPU usage
- Example: Using vmstat to check memory usage
- 10. Analyzing System Performance
- Example: Using
- Example: Monitoring disk I/O with
- 11. Viewing Open Files and Processes
- Example: View all processes using port 80
- Example: Find process ID by name
- Example: List all open files for a specific process
Gathering System Information
- 1. Displaying CPU Information
- Example: Get CPU model name
- Example: Show CPU cores and threads
- 2. Viewing Memory Information
- Example: Using free with different units
- Example: Monitoring memory usage over time
- 3. Listing PCI Devices
- Example: Display all PCI devices with verbose output
- Example: Display only devices on bus 0000:00
- 4. Listing USB Devices
- Example: Find USB device by vendor ID
- 5. Viewing Block Devices
- Example: Identify mounted filesystems on block devices
- 6. Displaying Hardware Information
- Example: Using lshw to get detailed hardware info
- Example: Displaying network hardware info
- 7. Listing Loaded Modules
- Example: Using lsmod to list loaded modules
- Example: Using modinfo to get details of a module
- 8. Viewing BIOS Information
- Example: Display BIOS Information
- 9. Checking Manufacturer Information
- Example: Retrieve System Manufacturer
- 10. Viewing System Statistics
- Example: Using vmstat to check memory usage
- Example: Using iostat to monitor disk I/O
Managing Hardware Devices
- 1. Viewing Device Information
- Example: View disk usage and partitions
- Example: Show detailed CPU info
- 2. Monitoring Hardware with sensors
- Example: Displaying sensor data
- 3. Testing Hard Drives
- Example: Check drive health with SMART
- Example: Test read/write speed with dd
- 4. Viewing Disk SMART Status
- Example: Check SMART status of /dev/sda
- SMART Status Indicators
- 5. Managing USB Devices
- Example: Identify USB device by vendor ID
- Example: View USB device details using udevadm
- 6. Configuring Sound Devices
- Example: Basic ALSA Configuration
- Example: Setting Default Audio Device
- 7. Managing Graphics Drivers
- Example: Install NVIDIA Driver
- Example: Check Driver Status
- 8. Controlling Laptop Brightness
- Example: Using brightnessctl to adjust brightness
- Example: Increasing brightness by 10%
- Example: Getting current brightness level
- 9. Managing Power Settings
- Example: Check power usage
- Example: Set CPU governor
- 10. Configuring Bluetooth
- Example: Enable Bluetooth on Boot
- Example: Pairing a Bluetooth Device
- 11. Viewing Battery Status
- Example: Check battery status with acpi
- Example: Read battery capacity directly
Managing Time and Localization
- 1. Viewing Current Time
- Example: Displaying formatted time
- 2. Setting System Time
- Example: Setting System Time with timedatectl
- 3. Configuring Time Zone
- Example: Setting Timezone
- 4. Synchronizing Time with NTP
- Example: Check NTP Status
- 5. Viewing NTP Status
- Example: Check NTP synchronization status
- 6. Configuring Hardware Clock
- Example: Setting Hardware Clock
- 7. Setting System Locale
- Example: Setting Locale via Environment Variable
- Example: Permanently Setting Locale in /etc/default/locale
- 8. Viewing Available Locales
- Example: List available locales using locale command
- Example: Display current locale settings
- 9. Generating Locales
- Example: Check Available Locales
- Example: Generate New Locale
- 10. Configuring Keyboard Layout
- Example: Set Keyboard Layout Using localectl
- Example: Set Keyboard Layout Using setxkbmap
Understanding Boot Process
- 1. Understanding BIOS vs UEFI Boot Sequence
- Example: UEFI Boot Process Overview
- 2. Understanding GRUB Bootloader
- Example: GRUB Configuration
- Example: Update GRUB Configuration
- GRUB Bootloader Overview
- 3. Configuring GRUB Settings
- Example: Modifying GRUB_TIMEOUT
- 4. Accessing GRUB Menu
- Example: Modifying GRUB Timeout
- 5. Booting into Single-User Mode
- Example: Booting into Single-User Mode
- 6. Understanding systemd Boot Targets
- Example: Check current boot target
- Example: Change boot target to graphical
- 7. Setting Default Boot Target
- Example: Change default boot target to graphical mode
- 8. Viewing Boot Messages
- Example: View boot messages with dmesg
- Example: Use journalctl to view boot logs
- 9. Repairing GRUB
- Example: Boot into Live USB and Repair GRUB
- 10. Using Emergency Mode
- Example: Booting into Emergency Mode
- Example: Using GRUB to Enter Emergency Mode
Managing Kernel and Modules
- 1. Viewing Loaded Modules
- Example: Check if a specific module is loaded
- 2. Loading Modules Manually
- Example: Load a module with modprobe
- Example: Load a module with insmod
- Example: Unload a module with rmmod
- 3. Removing Modules
- Example: Removing a Kernel Module
- 4. Viewing Module Information
- Example: Check module details
- 5. Configuring Module Parameters
- Example: Setting Module Parameter
- Example: Persistent Parameter Configuration
- 6. Blacklisting Modules
- Example: Blacklisting a Module
- 7. Updating Kernel
- Example: Update kernel on Ubuntu
- Update Process Summary
- 8. Viewing Available Kernels
- Example: Check running kernel version
- Example: List installed kernels (Debian/Ubuntu)
- 9. Removing Old Kernels
- Example: Remove Old Kernels
- 10. Managing initramfs
- Example: Update initramfs after kernel update
- Example: Create a new initramfs image
Managing Kernel Parameters
- 1. Viewing Kernel Parameters
- Example: View IP Forwarding Setting
- 2. Displaying Specific Parameter
- Example: Displaying a specific kernel parameter
- 3. Setting Temporary Parameters
- Example: Temporarily set a kernel parameter
- 4. Setting Permanent Parameters
- Example: Setting a permanent parameter
- 5. Reloading sysctl Configuration
- Example: Reloading sysctl Configuration
- 6. Tuning Network Parameters
- Example: Setting network parameters via sysctl
- Example: Making changes persistent
- 7. Tuning Memory Parameters
- Example: Setting swappiness to 10
- Example: Making swappiness persistent
- 8. Configuring TCP/IP Stack
- Example: Modifying TCP/IP Parameters
- Example: Making Changes Persistent
- 9. Loading Modules at Boot
- Example: Loading a module at boot using
- Example: Loading a module with options using
- Example: Setting module options using
- 10. Understanding /proc and /sys Filesystems
- Example: View kernel parameters via /proc
- Example: Modify kernel parameter via /sys
Implementing System Security
- 1. Configuring Firewall
- Example: Allow SSH Access
- Example: Deny HTTP Access
- 2. Managing SSH Security
- Example: SSH Configuration File
- SSH Security Best Practices
- 3. Updating System Packages
- Example: Update and upgrade system packages
- 4. Implementing Fail2ban
- Example: Basic jail configuration
- Example: Custom filter for application logs
- 5. Auditing System with Lynis
- Example: Running Lynis Audit
- Key Features of Lynis
- 6. Scanning for Rootkits
- Example: Using chkrootkit
- Example: Using rkhunter
- 7. Setting Password Policies
- Example: Enforcing password complexity
- 8. Enforcing Password Complexity
- Example: Setting Password Policy
- 9. Using sudo Securely
- Example: Securely running a command as root
- Best Practices for sudo Usage
- 10. Implementing File Integrity Monitoring
- Example: AIDE Configuration
- Example: AIDE Database Initialization
- 11. Securing Shared Memory
- Example: Setting Shared Memory Limits
- Example: Making Changes Permanent
- 12. Disabling Unnecessary Services
- Example: Disable a service using systemctl
Understanding Linux Capabilities
- 1. Understanding Capability Types
- Example: Setting Capabilities on a Binary
- 2. Viewing File Capabilities
- Example: Using getcap to view file capabilities
- Example: Using getcap on a directory
- 3. Setting File Capabilities
- Example: Setting Capabilities on a Binary
- Summary of Capabilities
- 4. Viewing Process Capabilities
- Example: Check Capabilities of a Process
- Example: View Capabilities of a Running Process
- Example: Set Capabilities on an Executable
- 5. Understanding Capability Sets
- Example: Viewing Current Capabilities
- Example: Setting Capabilities on a Binary
- 6. Using capsh for Testing
- Example: Testing capabilities with capsh
- 7. Dropping Capabilities
- Example: Dropping Capabilities with capsh
- 8. Understanding Capability Bounding Set
- Example: Setting capability bounding set
- 9. Comparing Capabilities vs SUID
- Example: Setting Capabilities
- Example: Setting SUID
- 10. Managing Capabilities with systemd
- Example: systemd service with capabilities
- Summary of systemd Capabilities
Managing Audit System
- 1. Installing and Enabling auditd
- Example: Basic auditd configuration
- 2. Viewing Audit Rules
- Example: View current audit rules
- 3. Adding File Watch Rules
- Example: Adding a File Watch Rule
- 4. Adding System Call Rules
- Example: Adding a System Call Rule
- 5. Searching Audit Logs
- Example: Search for login events in the last hour
- Example: Search for all failed login attempts
- 6. Generating Audit Reports
- Example: Generate a user activity report
- Example: Export audit report to a file
- 7. Configuring Audit Rules
- Example: Basic Audit Rule Configuration
- 8. Managing Audit Log Rotation
- Example: Configuring Audit Log Rotation
- Steps to Rotate Audit Logs Manually
- 9. Filtering Audit Events
- Example: Filtering by syscall and UID
- Example: Filtering by architecture and syscall
- 10. Understanding Audit Log Format
- Example: Audit Log Entry
Working with SELinux
- 1. Checking SELinux Status
- Example: Check SELinux status in a script
- 2. Setting SELinux Mode
- Example: Temporarily switch to permissive mode
- Example: Permanently set enforcing mode
- 3. Viewing Security Contexts
- Example: Check security context of a file
- Example: View process security context
- 4. Changing File Context
- Example: Change context for a web file
- 5. Restoring Default Context
- Example: Restoring Context to Web Content
- 6. Managing Policy Booleans
- Example: Toggle a Policy Boolean
- 7. Viewing SELinux Denials
- Example: Check SELinux denials using auditctl
- Example: Using sealert to analyze denials
- 8. Creating Custom Policies
- Example: Define a Custom Policy Module
- Example: Compile and Install Custom Policy
- 9. Managing SELinux Users
- Example: Adding a New SELinux User
- Example: Viewing SELinux User Mappings
- 10. Configuring Port Labels
- Example: Setting Port Label with semanage
- Example: Viewing Current Port Labels
- 11. Troubleshooting SELinux Issues
- Example: Check SELinux status and logs
- Example: Temporarily disable SELinux for testing
- SELinux Troubleshooting Workflow
Working with AppArmor
- 1. Checking AppArmor Status
- Example: Checking AppArmor Status
- 2. Listing AppArmor Profiles
- Example: Listing AppArmor Profiles
- 3. Setting Profile Modes
- Example: Setting Profile Mode
- 4. Viewing Profile Definitions
- Example: View loaded AppArmor profiles
- Example: View profile definition file
- 5. Creating Custom Profiles
- Example: Basic AppArmor Profile Structure
- Workflow: Creating and Loading a Custom AppArmor Profile
- 6. Updating Profiles
- Example: Updating a Profile
- 7. Disabling Profiles
- Example: Temporarily disabling a profile
- Example: Permanently disabling a profile
- 8. Reloading Profiles
- Example: Reloading a Profile
- 9. Debugging Profile Issues
- Example: Check AppArmor status
- Example: View AppArmor logs
- Workflow: Troubleshoot AppArmor Profile Issues
- 10. Understanding AppArmor vs SELinux
- AppArmor vs SELinux: Key Differences
Working with Containers and Namespaces
- 1. Understanding Namespaces
- Example: Creating a Network Namespace
- 2. Understanding Control Groups
- Example: Creating a new cgroup
- 3. Using systemd-nspawn
- Example: Running a container with systemd-nspawn
- Example: Running a container with port forwarding
- Key Features of systemd-nspawn
- 4. Creating Isolated Environments
- Example: Basic Namespace Isolation
- Example: Using User Namespace for Isolation
- Key Concepts in Namespace Isolation
- 5. Managing Resource Limits
- Example: Setting Memory Limit
- Example: Setting CPU Quota
- 6. Using unshare for Namespaces
- Example: Running a command in a new mount namespace
- Example: Isolating a process in a new PID namespace
- 7. Viewing Container Processes
- Example: Viewing Container Processes in a Namespace
- 8. Configuring cgroups v2
- Example: Enabling CPU and Memory Controllers
- Example: Setting CPU Quota
- Example: Limiting Memory Usage
- 9. Limiting CPU Usage
- Example: Setting CPU Quota
- 10. Limiting Memory Usage
- Example: Setting Memory Limits in cgroup
Backing Up and Recovering Data
- 1. Creating Backups with tar
- Example: Creating a compressed backup
- Example: Extracting a backup
- 2. Creating Incremental Backups
- Example: Using rsync for incremental backups
- 3. Backing Up with rsync
- Example: Basic rsync backup
- Example: Backup with deletion and compression
- 4. Creating Disk Images
- Example: Creating a disk image with dd
- Example: Using ddrescue for bad sector handling
- 5. Cloning Partitions with dd
- Example: Clone a Partition Using dd
- 6. Using rsnapshot for Snapshots
- Example: Basic rsnapshot Configuration
- Example: Running rsnapshot Backup
- 7. Backing Up with Duplicity
- Example: Basic Backup Command
- 8. Restoring from Backups
- Example: Restore a Directory from Tar Archive
- 9. Scheduling Automated Backups
- Example: Cron Job for Daily Backup
- Example: Weekly Backup with Log
- 10. Testing Backup Integrity
- Example: Verify integrity of a tar backup using checksums
Optimizing System Performance
- 1. Identifying Performance Bottlenecks
- Example: Using
- Example: Using
- Common Performance Bottlenecks
- 2. Tuning Swap Usage
- Example: Adjusting Swap Settings
- 3. Optimizing File System Performance
- Example: Mounting tmpfs with optimized size
- Example: Setting io.scheduler for SSD
- 4. Tuning I/O Scheduler
- Example: Setting I/O Scheduler for a Disk Device
- 5. Configuring CPU Governor
- Example: Check current CPU governor
- Example: Set CPU governor to performance
- 6. Managing Process Priorities
- Example: Setting Process Priority with nice
- Example: Changing Priority of Running Process with renice
- 7. Using Huge Pages
- Example: Allocating Huge Pages
- Example: Checking Huge Page Usage
- 8. Optimizing Network Stack
- Example: Apply network optimizations
- 9. Disabling Unnecessary Services
- Example: Disable a service permanently
- 10. Analyzing Performance with perf
- Example: Recording and analyzing CPU cycles
- 11. Profiling Applications
- Example: Using perf to profile a command
- Example: Using strace to analyze system calls
Understanding System Calls and Libraries
- 1. Tracing System Calls
- Example: Using strace to trace a command
- Example: Tracing a running process
- 2. Tracing Library Calls
- Example: Using ltrace to trace library calls
- 3. Viewing Shared Libraries
- Example: Using ldd to view dependencies
- 4. Managing Library Cache
- Example: Updating Library Cache
- 5. Setting Library Path
- Example: Setting Library Path Temporarily
- Example: Using LD_PRELOAD to Override System Library
- 6. Viewing Open Files
- Example: Using lsof to view open files for a process
- Example: Inspecting file descriptors via /proc
- 7. Finding File Descriptors
- Example: Viewing file descriptors for a process
- 8. Debugging with gdb
- Example: Basic gdb session
- 9. Analyzing Core Dumps
- Example: Analyzing a Core Dump with GDB
- 10. Using valgrind for Memory Analysis
- Example: Running valgrind on a simple C program
Troubleshooting Common Issues
- 1. Diagnosing Boot Failures
- Example: Check boot logs for errors
- Boot Failure Troubleshooting Steps
- 2. Recovering from Kernel Panics
- Example: Emergency Boot via GRUB
- Recovery Steps Summary
- 3. Fixing File System Errors
- Example: Checking for File System Errors
- 4. Resolving Network Connectivity Issues
- Example: Testing DNS Resolution
- Example: Checking Firewall Rules
- 5. Debugging Service Failures
- Example: Check service status and logs
- Common Service Issues and Solutions
- 6. Investigating High CPU Usage
- Example: Identify top CPU-consuming processes
- Example: Monitor CPU usage over time
- 7. Diagnosing Memory Issues
- Example: Check memory usage with free
- Example: Identify memory-hungry processes with ps
- Memory Diagnosis Workflow
- 8. Resolving Disk Space Issues
- Example: Cleaning up old logs
- Example: Identifying large directories
- 9. Fixing Permission Problems
- Example: Changing Ownership of a Directory
- Example: Setting Read/Write Permissions
- 10. Debugging DNS Issues
- Example: Check DNS resolution for a domain
- Example: Test DNS resolution with ping
- 11. Troubleshooting SSH Access
- Example: Check SSH service status
- Example: Test SSH connection with verbose logging