Migrate linux roadmap

This commit is contained in:
Kamran Ahmed
2025-06-14 03:10:44 +01:00
parent 2c5ae2d774
commit 9de76da66f
182 changed files with 3251 additions and 1536 deletions

View File

@@ -1,8 +1,6 @@
# Adding Disks
In Linux, hard disks and portable drives are managed and controlled through a series of directories and files, commonly referred to as the Linux Filesystem. When you add new disks in Linux, you need to prepare them before they can be used.
The process involves creating partitions on the disk, creating filesystem on the partitions, and then mounting the filesystems to directories in your systems directory tree. This becomes important especially when working with multiple disk drives or large data storage units in order to create a seamless user experience.
Adding disks in Linux involves partitioning, creating filesystems, and mounting. Use `lsblk` to list devices, `fdisk /dev/sdX` to create partitions, `mkfs.ext4 /dev/sdX1` to create filesystems, and `mount /dev/sdX1 /mount/point` to mount. This process prepares new storage devices for seamless integration into the Linux filesystem hierarchy.
The following are common commands to manage disks:

View File

@@ -0,0 +1,7 @@
# Archiving and Compressing
Linux archiving combines multiple files into single archives using `tar`, while compression reduces file sizes with `gzip` and `bzip2`. Use `tar cvf` to create archives, `tar xvf` to extract, and `tar cvzf` for gzip-compressed archives. These separate processes are often combined for efficient backup and distribution, with `tar.gz` and `tar.bz2` being common formats.
Learn more from the following resources:
- [@article@Linux File Packaging and Compression](https://labex.io/tutorials/linux-file-packaging-and-compression-385413)

View File

@@ -0,0 +1,3 @@
# Authentication Logs
Authentication logs record system login events, password changes, and sudo commands, located in `/var/log/auth.log` (Debian) or `/var/log/secure` (Red Hat/CentOS). Essential for monitoring server security, detecting brute force attacks and unauthorized access attempts. Use `tail /var/log/auth.log` to view recent entries. Regular analysis ensures server security and data integrity.

View File

@@ -0,0 +1,11 @@
# Authentication Logs
Authentication logs in Linux record all auth-related events like logins, password changes, and sudo commands. Located at `/var/log/auth.log` (Debian) or `/var/log/secure` (RHEL/CentOS), these logs help detect brute force attacks and unauthorized access attempts. Use `tail /var/log/auth.log` to view recent entries. Regular log analysis is essential for server security monitoring.
Here is an example of how you can use the `tail` command to view the last few entries of the authentication log:
```bash
tail /var/log/auth.log
```
Get yourself familiar with reading and understanding auth logs, as it's one essential way to keep your server secure.

View File

@@ -1,6 +1,6 @@
# Evaluating Available Memory
# Available Memory
When running several applications in a Linux environment, constant tracking of system health is crucial for smooth operations. Evaluating available memory as part of a server review is a common practice for system administrators. This involves using various command-line tools provided by Linux, such as `free`, `vmstat`, and `top`. These can assist in monitoring memory usage and performance metrics, ensuring systems are not overloaded, and adequate resources are available for important applications.
Evaluating available memory is crucial for Linux system health monitoring. Use command-line tools like `free`, `vmstat`, and `top` to track memory usage and performance metrics. The `free -h` command shows total, used, free, shared, buffer/cache, and available memory in human-readable format. Essential for maintaining optimal server performance and troubleshooting resource issues.
The `free` command, for instance, gives a summary of the overall memory usage including total used and free memory, swap memory and buffer/cache memory. Here's an example:

View File

@@ -0,0 +1,14 @@
# Available Memory and Disk
Linux provides tools like `free`, `vmstat`, and `top` to monitor system memory usage and performance. The `free -h` command shows total, used, free, shared, buffer/cache, and available memory in human-readable format. Regular memory monitoring helps maintain optimal server performance, prevent overload, and troubleshoot resource issues effectively.
The `free` command, for instance, gives a summary of the overall memory usage including total used and free memory, swap memory and buffer/cache memory. Here's an example:
```bash
$ free -h
total used free shared buff/cache available
Mem: 15Gi 10Gi 256Mi 690Mi 5.3Gi 4.2Gi
Swap: 8.0Gi 1.3Gi 6.7Gi
```
In this output, the '-h' option is used to present the results in a human-readable format. Understanding the state of memory usage in your Linux server can help maintain optimal server performance and troubleshoot any potential issues.

View File

@@ -0,0 +1,11 @@
# AWK
AWK is a powerful text-processing language for Unix-like systems, named after its creators Aho, Weinberger, and Kernighan. It reads files line by line, identifies patterns, and executes actions on matches. Commonly used in bash scripts for sorting, filtering, and report generation. Example: `awk '{print $1,$2}' filename` prints first two fields of each line.
Visit the following resources to learn more:
- [@article@IBM.com: Awk by Example](https://developer.ibm.com/tutorials/l-awk1/)
- [@article@Linux Handbook: Awk](https://linuxhandbook.com/awk-command-tutorial/)
- [@video@YouTube](https://www.youtube.com/watch?v=9YOZmI-zWok)
- [@feed@Explore top posts about Bash](https://app.daily.dev/tags/bash?ref=roadmapsh)
- [@article@Linux awk Command: Text Processing](https://labex.io/tutorials/linux-linux-awk-command-text-processing-388493)

View File

@@ -0,0 +1,24 @@
# Background and Foreground Processes
Linux processes run in foreground (fg) taking direct user input or background (bg) running independently. Start background processes with `command &` or use `Ctrl+Z` then `bg` to pause and resume in background. Use `fg` to bring background processes to foreground. These job control commands enable managing multiple tasks from a single terminal efficiently.
Here's how you can send a running process to background:
```bash
command &
```
Or if a process is already running:
```bash
CTRL + Z # This will pause the process
bg # This resumes the paused process in the background
```
And to bring it back to the foreground:
```bash
fg
```
These commands, `bg` and `fg` are part of job control in Unix-like operating systems, which lets you manage multiple tasks simultaneously from a single terminal.

View File

@@ -1,13 +0,0 @@
# Linux Backup Tools
In the world of Linux, there are a wide array of utilities and tools available for creating and managing backups of your important data. Backups are crucial to ensure the preservation and safety of data in the event of hardware failure, accidental deletion, or data corruption. Therefore, understanding how to leverage Linux backup tools is an essential skill for any system administrator or user.
Some of the popular and powerful backup tools in Linux include `rsync`, `tar`, `dump`, `restore`, and various GUI based tools such as `Deja Dup` and `Back In Time`. These tools provide various features such as incremental backups, automation, scheduling, and encryption support.
For instance, a basic usage of `rsync` can be shown below:
```bash
rsync -avz /source/directory/ /destination/directory
```
This command would create a backup by synchronizing the source directory with the destination directory. The options are as follows: `-a` (archive mode), `-v` (verbose), and `-z` (compress data).

View File

@@ -20,4 +20,4 @@ In this brief introduction, we will discuss and explore these basic commands and
Learn more from the following resources:
- [@article@Linux pwd Command: Directory Displaying](https://labex.io/tutorials/linux-file-and-directory-operations-17997)
- [@article@Linux pwd Command: Directory Displaying](https://labex.io/tutorials/linux-file-and-directory-operations-17997)

View File

@@ -0,0 +1,3 @@
# Background and Foreground Processes
Linux processes run in foreground (taking direct user input) or background (running independently). Send processes to background with `&` or `bg` command. Bring to foreground with `fg`. Use Ctrl+Z to pause, then `bg` to resume in background. Part of job control for managing multiple tasks simultaneously from single terminal.

View File

@@ -0,0 +1,16 @@
# Boot Loaders
Boot loaders load the OS kernel into memory when systems start. Common Linux boot loaders include GRUB (modern, feature-rich with graphical interface) and LILO (older, broader hardware support). Boot loaders initialize hardware, load drivers, start schedulers, and execute init processes. Use `sudo update-grub` to update GRUB configuration. Enable multi-OS booting on single machines.
```bash
# This command updates the GRUB bootloader
sudo update-grub
```
Irrespective of the type of Boot Loader used, understanding and configuring them properly is essential for maintaining an efficient, stable and secure operating system. Boot loaders also allow users to switch between different operating systems on the same machine, if required.
Visit the following resources to learn more:
- [@article@comprehensive documentation of Bootloader - archlinux wiki](https://wiki.archlinux.org/title/Arch_boot_process#Boot_loader)
- [@article@What Is GRUB Bootloader in Linux?](https://phoenixnap.com/kb/what-is-grub)
- [@official@The GNU GRUB website](https://www.gnu.org/software/grub/)

View File

@@ -1,18 +0,0 @@
# Boot Loaders
Boot Loaders play an integral role in booting up any Linux-based system. When the system is switched on, it's the Boot Loader that takes charge and loads the kernel of the OS into the systems memory. The kernel then initializes the hardware components and loads necessary drivers, after which it starts the scheduler and executes the init process.
Typically, the two most commonly used boot loaders in Linux are LILO (Linux Loader) and GRUB (GRand Unified Bootloader). GRUB sets the standard for modern day Linux booting, providing rich features like a graphical interface, scripting, and debugging capabilities. LILO, on the other hand, is older and does not have as many features, but runs on a broader range of hardware platforms.
```bash
# This command updates the GRUB bootloader
sudo update-grub
```
Irrespective of the type of Boot Loader used, understanding and configuring them properly is essential for maintaining an efficient, stable and secure operating system. Boot loaders also allow users to switch between different operating systems on the same machine, if required.
Visit the following resources to learn more:
- [@article@comprehensive documentation of Bootloader - archlinux wiki](https://wiki.archlinux.org/title/Arch_boot_process#Boot_loader)
- [@article@What Is GRUB Bootloader in Linux?](https://phoenixnap.com/kb/what-is-grub)
- [@official@The GNU GRUB website](https://www.gnu.org/software/grub/)

View File

@@ -1,18 +0,0 @@
# Booting Linux
Booting Linux refers to the process that the Linux operating system undergoes when a computer system is powered on. When you switch on your device, the system bootloader is loaded into the main memory from a fixed location to start the main operating system.
The whole process involves several stages including POST (Power-On Self Test), MBR (Master Boot Record), GRUB (GRand Unified Bootloader), Kernel, Init process, and finally the GUI or command line interface where users interact.
During this process, vital system checks are executed, hardware is detected, appropriate drivers are loaded, filesystems are mounted, necessary system processes are started, and finally, the user is presented with a login prompt.
Here is an example of the GRUB configuration file `/etc/default/grub` which is used to configure the GRUB bootloader options:
```bash
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
```
This is a basic introduction to booting Linux. However, the specifics may vary depending on the Linux distribution and the specific configurations of your system.

View File

@@ -0,0 +1,14 @@
# Booting Linux
Linux booting involves several stages: POST, MBR, GRUB, Kernel, Init, and GUI/CLI. The bootloader loads the kernel into memory, which detects hardware, loads drivers, mounts filesystems, starts system processes, and presents login prompts. GRUB configuration is managed through `/etc/default/grub` with settings like timeout and default boot options.
Here is an example of the GRUB configuration file `/etc/default/grub` which is used to configure the GRUB bootloader options:
```bash
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
```
This is a basic introduction to booting Linux. However, the specifics may vary depending on the Linux distribution and the specific configurations of your system.

View File

@@ -0,0 +1,18 @@
# Cgroups
Cgroups (control groups) are a Linux kernel feature that organizes processes into hierarchical groups and limits their resource usage (CPU, memory, disk I/O). Essential for containerization, cgroups prevent containers from monopolizing host resources, ensuring system stability and performance. Use `cgcreate` to create groups, assign processes, and set resource limits effectively.
Here's an example of how you might create a new cgroup for a container:
```bash
# Create a new cgroup for a container;
sudo cgcreate -g cpu:/my_new_container
# Assign the current shell's process to the new cgroup;
echo $$ | sudo tee /sys/fs/cgroup/cpu/my_new_container/tasks
# Limit the CPU usage of the cgroup to 20%;
echo 200000 | sudo tee /sys/fs/cgroup/cpu/my_new_container/cpu.cfs_quota_us
```
In this snippet, we are using `cgcreate` to create a new cgroup, then adding the current process to it, and finally setting a CPU limit.

View File

@@ -1,5 +1,7 @@
# Checking Logs
Linux system logs provide chronological records of events for debugging and troubleshooting, stored in `/var/log` directory. Use `dmesg` for kernel messages and `journalctl` for systemd logs. `journalctl -u service_name` shows logs for specific services. Essential skill for system administration, monitoring, and effective troubleshooting in Linux environments.
Checking Logs Under Service Management in Linux plays a vital role in systems administration and troubleshooting procedures. Logs are fundamental for an in-depth understanding of what's going on inside a Linux system. These records provide a chronological record of events related to your system for use in debugging and troubleshooting problems.
Several essential logs generated by system processes, users and administrator actions can be found in `/var/log` directory. Logs can be accessed and viewed using several commands. For example, the `dmesg` command can be used to display the kernel ring buffer. Most system logs are managed by `systemd` and can be checked using the command `journalctl`.
@@ -10,7 +12,7 @@ journalctl
This command will show the entire system log from the boot to the moment you're calling the journal.
To display logs for a specific service, the `-u` option can be used followed by the services name.
To display logs for a specific service, the `-u` option can be used followed by the service's name.
```shell
journalctl -u service_name

View File

@@ -1,8 +1,6 @@
# Start Stop Service
# Starting and Stopping Services
In Linux, Service Management refers to controlling and managing system services, such as firewall, network, database, and other essential services. This play a critical role in the system's functionality and stability.
One of the fundamental parts of service management in Linux is starting and stopping service. System administrators often need to start, stop, or restart services after an update or configuration changes. In Linux, this can be done using the `systemctl` command.
Linux service management involves controlling system services like databases, web servers, and network services. Use `systemctl start service_name` to start services, `systemctl stop service_name` to stop them, and `systemctl restart service_name` to restart. These commands require root permissions via sudo and are essential for system administration and configuration management.
Here is a simple example:

View File

@@ -0,0 +1,3 @@
# Checking Service Status
Checking service status in Linux helps monitor system health and troubleshoot issues. Use `systemctl status service_name` to view detailed service information including active state, process ID, and recent log entries. Commands like `systemctl is-active` and `systemctl is-enabled` provide quick status checks. Service status monitoring is crucial for maintaining system reliability and performance.

View File

@@ -0,0 +1,23 @@
# Conditionals
Shell conditionals allow scripts to make decisions based on conditions using `if`, `elif`, and `else` statements. These control process flow by evaluating string variables, arithmetic tests, or process status. Conditions are checked sequentially - if true, the corresponding code block executes; otherwise, it moves to the next condition until finding a match or reaching `else`.
Here's a simple illustration of how they work:
```bash
#!/bin/sh
a=10
b=20
if [ $a -lt 20 ]
then
echo "a is less than b"
elif [ $a -gt 20 ]
then
echo "a is greater than b"
else
echo "a is equal to b"
fi
```
In the above script, the condition inside the `if` statement is being checked. If the condition is `true`, then the code block inside the `if` statement gets executed, otherwise, it moves to the `elif` condition and so on. If none of those conditions is satisfied, then the code block inside the `else` statement will be executed.

View File

@@ -0,0 +1,3 @@
# Container Runtime
Container runtime is software responsible for running containers in Linux, providing image transport, storage, execution, and network interactions. Popular options include Docker (comprehensive ecosystem), Containerd (lightweight standalone), and CRI-O (Kubernetes-optimized). Each runtime offers specific features and benefits for different use cases in containerized application deployment and management.

View File

@@ -1,20 +0,0 @@
# Cgroups
Cgroups, short for control groups, is a Linux kernel feature which allows processes to be organized into hierarchical groups. Its crucial role in containerization, is its ability to limit, account and isolate the resource usage (CPU, memory, disk I/O, etc.) of these process groups.
In the context of containerization, where lightweight isolated environments are running on the same host machine, cgroups become paramount for efficient resource management. By using cgroups, one can ensure that each container doesn't monopolize host resources, leading to improved overall system stability and performance.
Here's an example of how you might create a new cgroup for a container:
```bash
# Create a new cgroup for a container;
sudo cgcreate -g cpu:/my_new_container
# Assign the current shell's process to the new cgroup;
echo $$ | sudo tee /sys/fs/cgroup/cpu/my_new_container/tasks
# Limit the CPU usage of the cgroup to 20%;
echo 200000 | sudo tee /sys/fs/cgroup/cpu/my_new_container/cpu.cfs_quota_us
```
In this snippet, we are using `cgcreate` to create a new cgroup, then adding the current process to it, and finally setting a CPU limit.

View File

@@ -1,11 +0,0 @@
# Container Runtime
Container runtime in Linux refers to the software that is responsible for running containers. Each container runtime provides specific features and benefits, with common capabilities including image transport and storage, container execution and supervision, low-level network and volume interactions, and more.
Under Linux, popular container runtime options include:
- Docker: Docker is probably the most common container runtime, featuring an excellent ecosystem and superb community support.
- Containerd: Originally developed as a high-level container runtime layer to be used in Docker, Containerd is now often used as a standalone runtime.
- CRI-O: A lightweight container runtime specifically optimized for Kubernetes.
In containerization, understanding the role of container runtime is integral as it helps in better designing and running your containerized applications. This further ensures reliability and efficient use of resources. Each container runtime can be suited for different use cases so it's best to understand their pros and cons to use them effectively.

View File

@@ -1,17 +0,0 @@
# Docker Under Containerization
Docker is a widely-used open-source platform that utilizes OS-level virtualization, typically referred to as "containerization", to develop, ship, and run applications effectively. Docker and containerization, especially within the Linux ecosystem, have revolutionized software development workflows by providing lightweight and isolated operational environments, known as containers, for applications and their dependencies. Docker allows development teams to package an application with all the parts it needs, such as libraries and other dependencies, and deploy it as a single package.
In Linux, each Docker container interacts directly with the Linux kernel. Due to the clever use of Linux Kernel features like namespaces and cgroups, these containers provide isolated spaces to run processes while sharing the same OS, leading to less overhead than traditional virtual machines.
Here's a basic example of running an application (for example, hello-world) with Docker on Linux:
```bash
# Pull the Docker image from Docker Hub
sudo docker pull hello-world
# Run the Docker container
sudo docker run hello-world
```
The above commands allow you to download a Docker image and run it on your Linux system, providing the foundation for deploying containers in development, testing, and production environments.

View File

@@ -1,13 +0,0 @@
# Containerization
Containerization is a virtualization method that involves encapsulating an application in a container with its own isolated operating environment. This advanced method allows apps to run reliably and quickly when moved from one computing environment to another. In Linux, this technology can be utilized using various open-source platforms like Docker and Kubernetes.
Containers are often compared with virtual machines (VMs). However, unlike VMs which need an entire operating system to run an application, a container shares the host systems user space. Thats why they are lightweight and faster.
In Linux, Docker is a popular tool used for containerization. Below is a basic example of how you would run a container in Docker:
```bash
docker run -it ubuntu bash
```
This command pulls the Ubuntu image from Docker Hub and runs it as a container on your system, providing you with an interactive terminal (`-it`) inside the container. This is just a simple use case, and Docker can be used for managing complex applications involving many containers.

View File

@@ -1,17 +0,0 @@
# Understanding Ulimits
Linux-based containerization technology such as Docker utilizes 'ulimits' as one of the security features to control the resource consumption for each running container. Ulimits (user limits) are a feature of the Linux kernel that restricts the resources that any single user can consume. These resources include open file handles, locked-in physical memory, and others.
Used effectively, ulimits can prevent a rogue or errant process in a particular container from exhausting the server's resources and creating a denial-of-service situation for other containers or processes.
In a containerized environment, it is crucial to skillfully manage these resource limits to ensure optimal performance and security of all containers.
```bash
# To see current ulimits:
ulimit -a
# To set a specific ulimit (soft limit), for example file handles:
ulimit -n 1024
```
Properly configuring and understanding ulimits especially in containerized environments is an essential part of system administration in Linux.

View File

@@ -0,0 +1,3 @@
# Containerization
Containerization is a virtualization method that encapsulates applications in containers with isolated operating environments, enabling reliable deployment across computing environments. Unlike VMs requiring full operating systems, containers share the host system's user space, making them lightweight and faster. Docker is a popular Linux containerization tool for managing complex applications.

View File

@@ -0,0 +1,8 @@
# Copying and Renaming Files
Essential Linux file operations use `cp` to copy files and `mv` to move/rename them. The `cp` command copies files from source to destination, while `mv` moves or renames files/directories. Both commands use the syntax `command source destination`. These case-sensitive commands are fundamental for daily file management tasks in Linux systems.
Learn more from the following resources:
- [@article@Linux cp Command: File Copying](https://labex.io/tutorials/linux-linux-cp-command-file-copying-209744)
- [@article@Linux mv Command: File Moving and Renaming](https://labex.io/tutorials/linux-linux-mv-command-file-moving-and-renaming-209743)

View File

@@ -0,0 +1,8 @@
# Creating, Updating, and Deleting Users
Linux user management involves creating, updating, and deleting user accounts for system security and resource management. Use `useradd` or `adduser` to create users, `usermod` to update user details like home directory or shell, and `userdel` to delete users. Effective user management maintains system security and organization in multi-user environments.
Learn more from the following resources:
- [@article@How to create, update, and delete users account on Linux](https://linuxconfig.org/how-to-create-modify-and-delete-users-account-on-linux)
- [@article@How to manage users in Linux](https://www.freecodecamp.org/news/how-to-manage-users-in-linux/)

View File

@@ -0,0 +1,8 @@
# Create, Update, and Delete Users
Linux user management involves creating, updating, and deleting user accounts for system security and resource utilization. Key commands: `useradd`/`adduser` (create users), `usermod` (update user details like home directory/shell), `userdel` (delete users). Essential for maintaining secure, organized multi-user system environments and efficient resource allocation.
Learn more from the following resources:
- [@article@How to create, update, and delete users account on Linux](https://linuxconfig.org/how-to-create-modify-and-delete-users-account-on-linux)
- [@article@How to manage users in Linux](https://www.freecodecamp.org/news/how-to-manage-users-in-linux/)

View File

@@ -0,0 +1,40 @@
# Creating Files
Creating files in Linux is about making new blank or filled files on your computer. You can use commands like `touch` to create an empty file, `echo` to make a file with some text inside, or `cat` to type directly into a new file. These commands help you set up and save your documents or data.
Here's an example of file creation with the `touch` command:
```bash
touch newfile.txt
```
and with `cat` command:
```bash
cat > newfile.txt
```
Both these commands create a new "newfile.txt" if it does not already exist.
# Deleting Files
Deleting files in Linux means getting rid of unwanted or unnecessary files from your computer. You use the `rm` command to delete a file, and it's permanent, so be careful. You can also use `rm -i` (interactive) to ask for confirmation before deleting, which helps prevent accidental loss of important files.
```bash
# Deletes the file named example.txt
rm example.txt
```
```bash
# Ask for confirmation
rm -i [filename]
```
```bash
# Removes an empty directory
rmdir [directory]
```
Learn more from the following resources:
- [@article@Linux rm Command: File Removing](https://labex.io/tutorials/linux-linux-rm-command-file-removing-209741)

View File

@@ -0,0 +1,3 @@
# Creating New Services
Creating custom services in Linux involves writing systemd service unit files that define how processes should start, stop, and restart. Service files are placed in `/etc/systemd/system/` and contain sections like [Unit], [Service], and [Install]. Use `systemctl enable` to enable services at boot and `systemctl start` to run them. Custom services allow automation of background processes.

View File

@@ -1,5 +1,7 @@
# Creating Services
Creating Linux services involves setting up background applications using systemd service files. Services run continuously performing essential tasks like web servers, databases, and mail servers. Create `.service` files in `/etc/systemd/system/` with Unit, Service, and Install sections. Control services using `systemctl` commands. Best practice: avoid running services as root for security.
In Linux, service management refers to starting, stopping, enabling, and managing software services. Understanding how to control services is crucial for controlling a Linux server or desktop.
Typically, a service is an application that runs in the background waiting to be used, or carrying out essential tasks. Common kinds of services include web servers, database servers, and mail servers.

View File

@@ -0,0 +1,6 @@
# Debugging
Shell script debugging in Linux uses tools like bash's `-x` option for execution traces, `trap`, `set` commands, and external tools like `shellcheck`. Use `#!/bin/bash -x` in scripts or `bash -x script.sh` from command line for tracing. These debugging options help detect, trace, and fix errors to make scripts more efficient and error-proof.
Visit the following sources to learn more:
- [@official@Official Bashdb Documentation](https://bashdb.readthedocs.io/en/latest/)

View File

@@ -1,6 +1,6 @@
# DHCP
# DHCP
The Dynamic Host Configuration Protocol (DHCP) is a critical component of any network. In Linux networking, it is used for allocating IP addresses dynamically within a network.
Dynamic Host Configuration Protocol (DHCP) automatically allocates IP addresses and network configuration to clients within a network. DHCP servers manage IP distribution ensuring unique addresses for each client machine. In Linux, install with `sudo apt-get install isc-dhcp-server` and configure via `/etc/dhcp/dhcpd.conf`. DHCP servers should have static IPs for effective management.
The DHCP server effectively manages the IP addresses and information related to them, making sure that each client machine gets a unique IP and all the correct network information.

View File

@@ -0,0 +1,19 @@
# Understanding Directory Hierarchy
In Linux, understanding the directory hierarchy is crucial for efficient navigation and file management. A Linux system's directory structure, also known as the Filesystem Hierarchy Standard (FHS), is a defined tree structure that helps to prevent files from being scattered all over the system and instead organise them in a logical and easy-to-navigate manner.
- `/`: Root directory, the top level of the file system.
- `/home`: User home directories.
- `/bin`: Essential binary executables.
- `/sbin`: System administration binaries.
- `/etc`: Configuration files.
- `/var`: Variable data (logs, spool files).
- `/usr`: User programs and data.
- `/lib`: Shared libraries.
- `/tmp`: Temporary files.
- `/opt`: Third-party applications.
Visit the following resources to learn more:
- [@article@Overview of File System Hierarchy Standard (FHS)](https://access.redhat.com/documentation/ru-ru/red_hat_enterprise_linux/4/html/reference_guide/s1-filesystem-fhs#s3-filesystem-usr).
- [@video@The Linux File System explained in 1,233 seconds](https://youtu.be/A3G-3hp88mo?si=sTJTSzubdb0Vizjr)

View File

@@ -0,0 +1,11 @@
# Disks and Filesystems
Linux supports various filesystems like EXT4, FAT32, NTFS, and Btrfs for organizing data on storage devices. Each filesystem has specific advantages - EXT4 for Linux systems, FAT32 for compatibility across operating systems. The `df -T` command displays mounted filesystems with their types, sizes, and available space information.
Here's an example of how to display the type of filesystems of your mounted devices with the "df" command in Linux:
```bash
df -T
```
The output shows the names of your disks, their filesystem types, and other additional information such as total space, used space, and available space on the disks.

View File

@@ -1,13 +0,0 @@
# Linux Disks Filesystems
Linux uses a variety of filesystems to allow us to store and retrieve data from the hardware of a computer system such as disks. The filesystem defines how data is organized, stored, and retrieved on these storage devices. Examples of popular Linux filesystems include EXT4, FAT32, NTFS, and Btrfs.
Each filesystem has its own advantages, disadvantages, and use cases. For example, EXT4 is typically used for Linux system volumes due to its robustness and compatibility with Linux, while FAT32 may be used for removable media like USB drives for its compatibility with almost all operating systems.
Here's an example of how to display the type of filesystems of your mounted devices with the "df" command in Linux:
```bash
df -T
```
The output shows the names of your disks, their filesystem types, and other additional information such as total space, used space, and available space on the disks.

View File

@@ -1,18 +0,0 @@
# Inodes
In a Linux filesystem, an inode (index node) is a core concept that represents a filesystem object such as a file or a directory. More specifically, an inode is a data structure that stores critical information about a file except its name and actual data. This information includes the file's size, owner, access permissions, access times, and more.
Every file or directory in a Linux filesystem has a unique inode, and each inode is identified by an inode number within its own filesystem. This inode number provides a way of tracking each file, acting as a unique identifier for the Linux operating system.
Whenever a file is created in Linux, it is automatically assigned an inode that stores its metadata. The structure and storage of inodes are handled by the filesystem, which means the kind and amount of metadata in an inode can differ between filesystems.
Although you would not interact with inodes directly in everyday usage, understanding inodes can be very helpful when dealing with advanced file operations, such as creating links or recovering deleted files.
```bash
# Retrieve the inode of a file
ls -i filename
```
Learn more from the following resources:
- [@article@Introduction to Inodes](https://linuxjourney.com/lesson/inodes)

View File

@@ -1,22 +0,0 @@
# Linux Logical Volume Manager (LVM)
The Linux Logical Volume Manager (LVM) is a device mapper framework that provides logical volume management for the Linux kernel. It was created to ease disk management, allowing for the use of abstracted storage devices, known as logical volumes, instead of using physical storage devices directly.
LVM is extremely flexible, and features include resizing volumes, mirroring volumes across multiple physical disks, and moving volumes between disks without needing to power down.
LVM works on 3 levels: Physical Volumes (PVs), Volume Groups (VGs), and Logical Volumes (LVs).
- PVs are the actual disks or partitions.
- VGs combine PVs into a single storage pool.
- LVs carve out portions from the VG to be used by the system.
To create an LVM, you need to follow these steps in Linux:
```bash
pvcreate /dev/sdb1
vgcreate my-vg /dev/sdb1
lvcreate -L 10G my-vg -n my-lv
```
In the above commands, we create a physical volume on `/dev/sdb1`, then create a volume group named `my-vg`. Finally, we carve out a 10GB logical volume from the volume group and name it `my-lv`.
These features, collectively, provide great ease in managing storage systems especially for large enterprise class systems where a large array of disks are typically used.

View File

@@ -1,22 +0,0 @@
# Mounts
In Linux environments, a very crucial concept related to disk management is the "mounting" of filesystems. Fundamentally, mounting in Linux refers to the process that allows the operating system to access data stored on underlying storage devices, such as hard drives or SSDs. This process attaches a filesystem (available on some storage medium) to a specific directory (also known as a mount point) in the Linux directory tree.
The beauty of this approach lies in the unified and seamless manner in which Linux treats all files, irrespective of whether they reside on a local disk, network location, or any other kind of storage device.
The `mount` command in Linux is used for mounting filesystems. When a specific filesystem is 'mounted' at a particular directory, the system can begin reading data from the device and interpreting it according to the filesystem's rules.
It's worth noting that Linux has a special directory, `/mnt`, that is conventionally used as a temporary mount point for manual mounting and unmounting operations.
```sh
mount /dev/sdb1 /mnt
```
The above command will mount the filesystem (assuming it's a valid one) on the second partition of a second hard drive at the `/mnt` directory. After the partition is mounted, you can access the files using the `/mnt` directory.
Understanding and managing mounts is crucial for effective Linux disk and filesystem management.
Visit the following resources to learn more:
- [@article@Mounting, unmounting and the /mnt directory - The Linux Documentation Project](https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/mnt.html)
- [@article@Linux `mount` command with Examples](https://phoenixnap.com/kb/linux-mount-command)
- [@official@The `mount` command manual page](https://man7.org/linux/man-pages/man8/mount.8.html)

View File

@@ -0,0 +1,11 @@
# Disks and Filesystems
Linux uses various filesystems to organize, store, and retrieve data from storage devices. Popular filesystems include EXT4 (robust for Linux volumes), FAT32 (compatible with all OS for removable media), NTFS, and Btrfs. Each has specific advantages and use cases. Use `df -T` command to display filesystem types, disk space usage, and mounted device information.
Here's an example of how to display the type of filesystems of your mounted devices with the "df" command in Linux:
```bash
df -T
```
The output shows the names of your disks, their filesystem types, and other additional information such as total space, used space, and available space on the disks.

View File

@@ -0,0 +1,17 @@
# DNS Resolution
DNS (Domain Name System) converts hostnames to IP addresses, enabling users to access websites without remembering numeric addresses. Linux systems use `/etc/resolv.conf` to configure DNS resolution. Applications consult the DNS resolver, which communicates with DNS servers for address translation. Use `nslookup` or `dig` commands to query DNS and troubleshoot network connectivity issues.
Below command is used to query DNS and fetch IP addresses:
```bash
nslookup www.example.com
```
Or using dig command:
```bash
dig www.example.com
```
Getting a good understanding of the DNS resolution process provides a solid base for tasks like network troubleshooting and web server setup on a Linux system.

View File

@@ -0,0 +1,15 @@
# Docker
Docker is an open-source containerization platform that uses OS-level virtualization to package applications with dependencies into lightweight containers. In Linux, Docker containers share the kernel and use features like namespaces and cgroups for isolation. This provides less overhead than traditional VMs while enabling consistent deployment across environments.
Here's a basic example of running an application (for example, hello-world) with Docker on Linux:
```bash
# Pull the Docker image from Docker Hub
sudo docker pull hello-world
# Run the Docker container
sudo docker run hello-world
```
The above commands allow you to download a Docker image and run it on your Linux system, providing the foundation for deploying containers in development, testing, and production environments.

View File

@@ -0,0 +1,8 @@
# Ethernet, ARP, and RARP
Key networking protocols in Linux include Ethernet (LAN communication standard), ARP (Address Resolution Protocol - converts IP to MAC addresses), and RARP (Reverse ARP - converts MAC to IP addresses). These protocols enable local network communication and address resolution, essential for network troubleshooting and management in Linux systems.
Visit the following resources to learn more:
- [@video@ARP Explained - Address Resolution Protocol](https://www.youtube.com/watch?v=cn8Zxh9bPio)
- [@video@What is Ethernet?](https://www.youtube.com/watch?v=HLziLmaYsO0)

View File

@@ -0,0 +1,8 @@
# Ethernet, ARP and RARP
Three crucial Linux networking components: Ethernet enables LAN device communication, ARP (Address Resolution Protocol) translates IP addresses to MAC addresses for direct network communication, and RARP (Reverse ARP) converts MAC addresses to IP addresses when devices know their MAC but need their IP. Essential for diagnosing and managing Linux networking issues.
Visit the following resources to learn more:
- [@video@ARP Explained - Address Resolution Protocol](https://www.youtube.com/watch?v=cn8Zxh9bPio)
- [@video@What is Ethernet?](https://www.youtube.com/watch?v=HLziLmaYsO0)

View File

@@ -0,0 +1,3 @@
# Expand
The `expand` command converts tabs to spaces in text files, useful for consistent formatting across different systems and editors. Default conversion is 8 spaces per tab. Use `expand filename` for basic conversion or `expand -t 4 filename` to specify 4 spaces per tab. Essential for maintaining code readability and consistent indentation in shell scripts.

View File

@@ -0,0 +1,19 @@
# File Permissions
Linux file permissions control who can read (r), write (w), or execute (x) files and directories. Permissions are set for owner, group, and others using octal notation or symbolic format. The format `-rwxr--r--` shows file type and permissions. Use `chmod` to change permissions, `chown` for ownership, and `chgrp` for group ownership. Proper permissions ensure system security.
Let's have a look at an example:
```bash
-rwxr--r-- 1 root root 4096 Jan 1 12:00 filename
```
From the above example, the first character `-` indicates if it is a regular file(`-`) or directory(`d`). The following group of three characters(`rwx`) represents the permissions for the file owner. The next three characters(`r--`) represent permissions for the group and the last set of three characters(`r--`) represents permissions for others.
The `r` indicates that the file can be read, `w` indicates that the file can be written to, and `x` indicates that the file can be executed.
Learn more from the following resources:
- [@article@Linux File Permissions](https://linuxhandbook.com/linux-file-permissions/)
- [@video@Linux File Permissions in 5 Minutes](https://www.youtube.com/watch?v=LnKoncbQBsM)
- [@article@Linux Permissions of Files](https://labex.io/tutorials/linux-permissions-of-files-270252)

View File

@@ -0,0 +1,11 @@
# File Transfer
Linux file transfer involves copying or moving files between systems over networks. Command-line tools support protocols like FTP, HTTP, SCP, SFTP, and NFS. Common commands include `scp`, `rsync`, and `wget`. Example: `scp /local/file username@remote:/destination` copies files to remote systems. These tools make network file sharing streamlined, easier, and more secure.
For instance, when transferring a file from a local machine to a remote server, the `scp` command can be utilized as follows:
```bash
scp /path/to/local/file username@remote:/path/to/destination
```
This command would copy the file to the designated remote system.
Understanding and efficiently using these tools can make the task of file sharing over networks streamlined, easier, and more secure.

View File

@@ -1,6 +1,6 @@
# Filesystems
Linux operating system provides multiple ways to handle the data storage through the concept of filesystems under disks. Filesystems, in essence, is the way how files are stored and organized on the storage disk. It's a critical component of the system as it ensures the integrity, reliability and efficient access to the data.
Filesystems define how files are stored and organized on Linux storage disks, ensuring data integrity, reliability, and efficient access. Linux supports various types like EXT4, XFS, BTRFS with different performance and recovery capabilities. All files start from root directory '/'. Use `df -T` to display filesystem types and disk usage status. Essential for Linux administration tasks.
A disk installed in a Linux system can be divided into multiple partitions, each with its own filesystem. Linux supports various types of filesystems, such as EXT4, XFS, BTRFS, etc. Each one of them has their own advantages regarding performance, data integrity and recovery options.

View File

@@ -0,0 +1,19 @@
# Finding and Installing Packages
Linux package managers like `apt`, `yum`, and `dnf` automate software installation, updates, and removal. Use `apt-get update && apt-get install package-name` on Debian/Ubuntu systems or `dnf install package-name` on Fedora/CentOS. Package management eliminates manual compilation from source code and requires appropriate permissions (usually root access).
For example, on a Debian-based system like Ubuntu you would use `apt` or `apt-get` to install a new package like so:
```
sudo apt-get update
sudo apt-get install package-name
```
While in a Fedora or CentOS you would use `dnf` or `yum`:
```
sudo dnf update
sudo dnf install package-name
```
Note that you should replace `package-name` with the name of the package you want to install. Remember that you will need appropriate permissions (often root) to install packages in a Linux system.

View File

@@ -1,6 +1,6 @@
# Finding and Installing Packages
The ability to efficiently find and install software packages is a fundamental skill when working with Linux based systems. Linux package management tools such as `apt`, `yum`, or `dnf` are used to automate the process of installing, upgrading, configuring, and removing software packages in a consistent manner.
Linux package managers like `apt`, `yum`, and `dnf` automate software installation, upgrading, configuring, and removal. Debian-based systems: `sudo apt-get update && sudo apt-get install package-name`. Fedora/CentOS: `sudo dnf update && sudo dnf install package-name`. Package management eliminates manual compilation from source code. Root permissions required for installation.
It's important to understand how package management works in Linux, because it significantly simplifies the process of software management, eliminating the need to manually download, compile, and install software from source code.

View File

@@ -1,6 +1,6 @@
# GREP in Text Processing
# GREP
GREP (Global Regular Expression Print) is considered a significant tool in text processing area on Unix-like operating systems including Linux. It is a powerful utility that searches and filters text matching a given pattern. When it identifies a line that matches the pattern, it prints the line to the screen, offering an effective and a codified way to find text within files.
GREP (Global Regular Expression Print) is a powerful text search utility that finds and filters text matching specific patterns in files. It searches line by line and prints matching lines to the screen. Essential for shell scripts and command-line operations. Example: `grep "pattern" fileName` searches for specified patterns. Alternative: `ripgrep` offers enhanced performance and features.
An essential part of many shell scripts, bash commands, and command-line operations, GREP is a versatile tool that comes pre-installed with every Linux distribution. It embodies three main parts - format, action and regex. Over the years, it had been effectively utilized in multiple programming languages and data science applications.

View File

@@ -1,6 +1,6 @@
# ICMP
Internet Control Message Protocol (ICMP) is a supportive protocol used primarily by network devices to communicate updates or error information to other devices. When troubleshooting network issues in a Linux environment, ICMP forms a crucial aspect. It can be utilized to send error messages indicating, for example, that a requested service is not available or that a host or router could not be reached. ICMP can also be used to relay query messages.
Internet Control Message Protocol (ICMP) is a supportive protocol used by network devices to communicate error messages and operational information. Essential for Linux network troubleshooting, ICMP enables tools like `ping` and `traceroute` to diagnose network connectivity and routing issues. Use `ping www.google.com` to send ICMP echo requests and test network reachability effectively.
In Linux systems, common command-line tools related to ICMP include `ping` and `traceroute`, both used to diagnose the state of the network and often part of troubleshooting efforts.

View File

@@ -1 +0,0 @@
#

View File

@@ -0,0 +1,12 @@
# Inodes
An inode (index node) is a data structure in Linux filesystems that stores metadata about files and directories except their names and actual data. Contains file size, owner, permissions, timestamps, and more. Each file has a unique inode number for identification. Understanding inodes helps with advanced operations like linking and file recovery. Use `ls -i filename` to view inode numbers.
```bash
# Retrieve the inode of a file
ls -i filename
```
Learn more from the following resources:
- [@article@Introduction to Inodes](https://linuxjourney.com/lesson/inodes)

View File

@@ -0,0 +1,11 @@
# Installing, Removing, and Upgrading Packages
Package management in Linux involves installing, removing, and upgrading software using distribution-specific tools. Use `apt` for Debian/Ubuntu, `yum`/`dnf` for Fedora/RHEL/CentOS, and `zypper` for SUSE. Common operations include `install package-name`, `remove package-name`, and `upgrade` commands. Each package manager has specific syntax but similar functionality for software lifecycle management.
A typical package management task such as installing a new package using `apt` would involve executing a command like:
```bash
sudo apt-get install packagename
```
However, the exact command varies depending on the package manager in use. Similarly, removing and upgrading packages also utilize command-line instructions specific to each package manager. Detailed understanding of these tasks is crucial for effective Linux system administration.

View File

@@ -1,4 +1,6 @@
# Installation, Removal, and Upgrade of Packages
# Install, Remove, and Upgrade Packages
Linux package management handles installing, removing, and upgrading pre-compiled software modules. Different distributions use specific package managers: `apt` (Debian/Ubuntu), `yum`/`dnf` (Fedora/RHEL/CentOS), `zypper` (SUSE). Example installation: `sudo apt-get install packagename`. Each manager has specific commands for removal and upgrades. Critical skill for effective Linux system administration.
Managing packages in a Linux system is one of the critical tasks that every Linux user and system administrator must be familiar with. Packages in Linux are pre-compiled software modules that include executables and files required to run and use the software. Linux distributions use different package managers such as `apt` for Debian/Ubuntu based distributions, `yum` and `dnf` for Fedora/RHEL/CentOS, and `zypper` for SUSE.

View File

@@ -1,6 +1,6 @@
# IP Routing
# IP Routing
IP Routing in Linux refers to the process of setting up routing tables and configuring network routes for networking interfaces within the Linux operating system. It is the kernels responsibility to handle this task which involves the selection of pathways for sending network packets across to their intended destinations on a network.
IP routing in Linux involves configuring routing tables and network routes for packet forwarding across networks. The kernel handles route selection to send packets to their destinations. Use the `ip` command (replacing deprecated `ifconfig`) for network configuration. Example: `ip route show` displays all kernel-known routes for network troubleshooting and management.
This task is carried out using various command-line tools and the networking configuration files. The principle command-line tool for network configuration in Linux used to be `ifconfig`, but it has now been mostly replaced by the `ip` command.

View File

@@ -1,6 +1,6 @@
# Kill Processes
On any Linux system, whether you're on a server or a desktop system, processes are consistently running. Sometimes, these processes may not behave as expected due to certain reasons like system bugs, unexpected system behavior, or accidental initiation and may require termination. This is where the concept of killing processes in Linux comes to picture under the area of process management.
The `kill` command terminates processes manually by sending specific signals to Process IDs (PIDs). Used when processes behave unexpectedly due to system bugs or accidental initiation. Syntax: `kill [signal or option] PID(s)`. Essential for Linux process management, allowing administrators to stop, pause, or terminate problematic processes and maintain system stability.
'Kill' in Linux is a built-in command that is used to terminate processes manually. You can use the `kill` command to send a specific signal to a process. When we use the `kill` command, we basically request a process to stop, pause, or terminate.

View File

@@ -0,0 +1,13 @@
# Killing Processes
The `kill` command terminates processes in Linux by sending signals to specific Process IDs (PIDs). Use `kill [signal] PID` to terminate processes manually. Different signals provide various termination methods - SIGTERM for graceful shutdown, SIGKILL for forced termination. Process termination is essential for managing unresponsive or unwanted processes.
'Kill' in Linux is a built-in command that is used to terminate processes manually. You can use the `kill` command to send a specific signal to a process. When we use the `kill` command, we basically request a process to stop, pause, or terminate.
Here's a basic illustration on how to use the `kill` command in Linux:
```bash
kill [signal or option] PID(s)
```
In practice, you would identify the Process ID (PID) of the process you want to terminate and replace PID(s) in the above command. The signal or option part is optional, but very powerful allowing for specific termination actions.

View File

@@ -0,0 +1,25 @@
# Listing and Finding Processes
Linux provides several tools to list and monitor running processes. The `/proc` filesystem contains process information accessible via PID directories. Commands like `ps -ef` show process snapshots, while `top` and `htop` provide real-time process monitoring. Use `cat /proc/{PID}/status` to view specific process details. These tools are essential for system monitoring and troubleshooting.
```bash
# list all running processes
ps -ef
# display ongoing list of running processes
top
# alternatively, for a more user-friendly interface
htop
```
Exploring the proc directory (`/proc`), we dive even deeper, enabling us to view the system's kernel parameters and each process's specific system details.
```bash
# view specifics of a particular PID
cat /proc/{PID}/status
```
In short, 'Finding and Listing Processes (proc)' in Linux is not just a core aspect of process management, but also a necessary skill for enhancing system performance and resolution of issues.
Visit the following resources to learn more:
- [@article@The /proc File System](https://www.kernel.org/doc/html/latest/filesystems/proc.html)

View File

@@ -0,0 +1,17 @@
# Listing Installed Packages
Linux distributions use different package managers: `apt` (Debian-based), `dnf` (Fedora), `zypper` (OpenSUSE), `pacman` (Arch). Listing installed packages helps with auditing software and deployment automation. Commands: `sudo apt list --installed` for apt systems, `dnf list installed` for dnf systems. Each distribution has its own syntax for this command.
Below is the command for listing installed packages in an `apt` package manager:
```shell
sudo apt list --installed
```
For `dnf` package manager, you would use:
```shell
dnf list installed
```
Remember, different distributions will have their own syntax for this command.

View File

@@ -0,0 +1,17 @@
# Literals
Shell literals are fixed values in source code including string literals (enclosed in quotes), numeric literals (sequences of digits), and boolean literals (1=true, 0=false). String examples: 'Hello, world!' or "Hello, world!". Numeric examples: 25, 100, 1234. Understanding literals is fundamental for shell scripting readability and functionality in Linux programming.
```bash
#!/bin/bash
# Example of literals in shell script
StringLiteral="This is a string literal"
NumericLiteral=125
echo $StringLiteral
echo $NumericLiteral
```
In this example, `StringLiteral` and `NumericLiteral` are literals and `echo` is used to print them.
Always remember, a good understanding of literals is fundamental when it comes to shell scripting in Linux.

View File

@@ -1,6 +1,6 @@
# Introduction to Logs
# System Logs
Linux, much like other operating systems, maintains logs to help administrators understand what is happening on the system. These logs document everything, including users' activities, system errors, and kernel messages. A particularly important time for insightful log messages is during the system boot process, when key system components are loaded and initialized.
Linux maintains logs documenting system activities, errors, and kernel messages. Boot logs record all operations during system startup for troubleshooting. Use `dmesg` to view kernel ring buffer messages in real-time, or access logs in `/var/log`. Systemd uses `journalctl` for logging. Log levels range from emergency (system unusable) to debug messages.
The "logs under booting" in Linux refers to the messages and information that are generated during the boot process. These logs record all operations and events that take place while the system is booting, which might assist in diagnosing a system issue or understanding system behavior.

View File

@@ -1,6 +1,6 @@
# Loops
Loops in shell programming are a fundamental concept that allows a certain block of code to be executed over and over again based on a given condition. They are crucial for automating repetitive tasks, thus making the coding process more efficient and less error-prone.
Shell loops automate repetitive tasks by executing code blocks based on conditions. Three types exist: `for` (iterates over item lists), `while` (executes while condition is true), and `until` (runs until condition becomes true). Example: `for i in 1 2 3; do echo "$i"; done` outputs each number. Loops enhance script efficiency and enable effective automation.
In Linux, shell scripts commonly use three types of loops - for, while, and until.

View File

@@ -0,0 +1,14 @@
# LVM (Logical Volume Manager)
LVM provides logical volume management through device mapper framework, offering flexible disk management with resizing, mirroring, and moving capabilities. Three levels: Physical Volumes (PVs - actual disks), Volume Groups (VGs - storage pools), and Logical Volumes (LVs - carved portions). Create with `pvcreate`, `vgcreate`, and `lvcreate` commands. Essential for enterprise storage systems.
To create an LVM, you need to follow these steps in Linux:
```bash
pvcreate /dev/sdb1
vgcreate my-vg /dev/sdb1
lvcreate -L 10G my-vg -n my-lv
```
In the above commands, we create a physical volume on `/dev/sdb1`, then create a volume group named `my-vg`. Finally, we carve out a 10GB logical volume from the volume group and name it `my-lv`.
These features, collectively, provide great ease in managing storage systems especially for large enterprise class systems where a large array of disks are typically used.

View File

@@ -0,0 +1,8 @@
# Managing Permissions
Linux file permissions control access to files and directories using read, write, and execute rights for user, group, and others. Use `chmod` to change permissions, `chown` to change ownership, and `chgrp` to change group ownership. Proper permission management is essential for system security and prevents unauthorized access to sensitive files and directories.
Learn more from the following resources:
- [@article@Linux file permissions explained](https://www.redhat.com/sysadmin/linux-file-permissions-explained)
- [@video@Linux file permissions in 5 minutes](https://www.youtube.com/watch?v=LnKoncbQBsM)

View File

@@ -0,0 +1,8 @@
# Mounts
Mounting in Linux attaches filesystems to specific directories (mount points) in the directory tree, allowing the OS to access data on storage devices. The `mount` command performs this operation. Example: `mount /dev/sdb1 /mnt` mounts second partition to `/mnt` directory. The `/mnt` directory is conventionally used for temporary mounting operations. Essential for Linux disk and filesystem management.
Visit the following resources to learn more:
- [@article@Mounting, unmounting and the /mnt directory - The Linux Documentation Project](https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/mnt.html)
- [@article@Linux `mount` command with Examples](https://phoenixnap.com/kb/linux-mount-command)
- [@official@The `mount` command manual page](https://man7.org/linux/man-pages/man8/mount.8.html)

View File

@@ -0,0 +1,7 @@
# Moving Files and Directories
The `mv` command moves files and directories between locations and can also rename them. Use syntax `mv [options] source destination` where source is the file/directory to move and destination is the target location. This versatile command is essential for file organization and management in Linux systems.
Learn more from the following resources:
- [@article@Linux mv Command: File Moving and Renaming](https://labex.io/tutorials/linux-linux-mv-command-file-moving-and-renaming-209743)

View File

@@ -14,4 +14,4 @@ The `mv` command is widely used because of its simplicity and versatility. Wheth
Learn more from the following resources:
- [@article@Linux mv Command: File Moving and Renaming](https://labex.io/tutorials/linux-linux-mv-command-file-moving-and-renaming-209743)
- [@article@Linux mv Command: File Moving and Renaming](https://labex.io/tutorials/linux-linux-mv-command-file-moving-and-renaming-209743)

View File

@@ -21,4 +21,4 @@ Visit the following resources to learn more:
- [@article@Intro to Linux](https://www.linkedin.com/pulse/intro-linux-fundamentals-what-hillary-nyakundi-4u7af/)
- [@video@Linux fundamentals](https://www.youtube.com/watch?v=kPylihJRG70&t=1381s&ab_channel=TryHackMe)
- [@article@Practice on Linux fundamentals](https://linuxjourney.com/)
- [@course@Linux for Noobs (Hands-on)](https://labex.io/courses/linux-for-noobs)
- [@course@Linux for Noobs (Hands-on)](https://labex.io/courses/linux-for-noobs)

View File

@@ -1,8 +1,6 @@
# Netfilter
# Netfilter
Netfilter is a powerful tool included in Linux that provides the functionality for maneuvering and altering network packets. It is essentially a framework that acts as an interface between the kernel and the packet, allowing for the manipulation and transformation of packets in transit.
Netfilter's primary application is in developing firewall systems and managing network address translations (NATs). In Linux, netfilter is extremely valuable due to the wide range of applications it offers, from traffic control, packet modification, logging, and network intrusion detection.
Netfilter is a Linux kernel framework for manipulating and filtering network packets. It provides hooks at various stages (prerouting, input, forward, output, postrouting) for custom functions. Primary applications include firewalls and NAT management. Works with iptables for configuration. Essential for traffic control, packet modification, logging, and intrusion detection in Linux systems.
The structure of netfilter allows for custom functions, often referred to as hooks, to be inserted into the kernel's networking stack. These hooks can manipulate or inspect packets at various stages like prerouting, local in, forward, local out, and postrouting.

View File

@@ -1,6 +1,6 @@
# Netstat
# Netstat
Netstat, short for network statistics, is a built-in command-line tool used in Linux systems for network troubleshooting and performance measurement. It provides statistics for protocols, a list of open ports, routing table information, and other important network details. Administrators and developers work with netstat to examine network issues and understand how a system communicates with others.
Netstat is a command-line tool for network troubleshooting and performance measurement in Linux. It provides network statistics, open ports, routing table information, and protocol details. Use options like `-n` for numerical addresses, `-c` for continuous monitoring, and `-t`/`-u` for specific protocols. Example: `netstat -n` lists all connections with numerical values.
Its functionality is extended owing to various command-line options it supports, which could be used singularly or combinedly to fine-tune the output. These might include displaying numerical addresses instead of names (`-n`), continuous monitoring (`-c`), or spotting connections on a specific protocol (`-t`, `-u`).

View File

@@ -1,19 +0,0 @@
# DNS Resolution in Networking on Linux
Domain Name System (DNS) is a decentralized system used for converting hostnames into IP addresses, making it easier for users to access websites without having to remember specific numeric IP addresses. DNS resolution, therefore, is a critical aspect of networking in Linux.
On Linux systems, when an application needs to connect to a certain URL, it consults the DNS resolver. This resolver, using the file `/etc/resolv.conf`, communicates with the DNS server, which then converts the URL into an IP address to establish a network connection.
Below command is used to query DNS and fetch IP addresses:
```bash
nslookup www.example.com
```
Or using dig command:
```bash
dig www.example.com
```
Getting a good understanding of the DNS resolution process provides a solid base for tasks like network troubleshooting and web server setup on a Linux system.

View File

@@ -1,14 +0,0 @@
# Ethernet, ARP and RARP
Linux serves as a prevalent OS choice for networking due to its robust, customizable, and open-source nature. Understanding networking in Linux involves comprehending various protocols and tools. Three crucial components of this landscape include Ethernet, ARP (Address Resolution Protocol), and RARP (Reverse Address Resolution Protocol).
- Ethernet: It's the most widely installed LAN (Local Area Network) technology, allowing devices to communicate within a local area network.
- ARP: As per its name, it provides address resolution, translating IP addresses into MAC (Media Access Control) addresses, facilitating more direct network communication.
- RARP: It is the Reverse Address Resolution Protocol, working in the opposite way to ARP. It converts MAC addresses into IP addresses, which is useful in scenarios when a computer knows its MAC address but needs to find out its IP address.
Knowledge of these components is indispensable in diagnosing and managing networking issues in Linux.
Visit the following resources to learn more:
- [@video@ARP Explained - Address Resolution Protocol](https://www.youtube.com/watch?v=cn8Zxh9bPio)
- [@video@What is Ethernet?](https://www.youtube.com/watch?v=HLziLmaYsO0)

View File

@@ -1,13 +0,0 @@
# Linux File Transfer under Networking
In Linux, file transfer is an act of copying or moving a file from one computer to another over a network connection. This concept is essential for system administrators and end-users who require the ability to share files between systems or networks.
Linux provides several command-line tools and applications for network-based file transfers. These tools support various standard protocols such as FTP, HTTP, SCP, SFTP, and NFS. Some of the most well-known commands for file transfer include `scp`, `rsync`, and `wget`.
For instance, when transferring a file from a local machine to a remote server, the `scp` command can be utilized as follows:
```bash
scp /path/to/local/file username@remote:/path/to/destination
```
This command would copy the file to the designated remote system.
Understanding and efficiently using these tools can make the task of file sharing over networks streamlined, easier, and more secure.

View File

@@ -1,13 +0,0 @@
# Networking
Networking is a crucial aspect in the Linux environment. It enables Linux systems to connect, interact, and share resources with other systems, be it Linux, Windows, macOS or any other operating system. Linux provides a wealth of tools and commands to manage network interfaces, view their configuration details, troubleshoot issues and automate tasks, demonstrating its robustness and versatility. The Linux networking stack is well-regarded for its performance, its ability to run large-scale and exhaustive configurations, and its support for a wide variety of network protocols.
Linux adopts a file-based approach for network configuration, storing network-related settings and configurations in standard files, such as /etc/network/interfaces or /etc/sysconfig/network-scripts/, depending on the Linux distribution.
Perhaps one of the most popular commands related to networking on a Linux system is the `ifconfig` command:
```bash
ifconfig
```
This will output information about all network interfaces currently active on the system. However, please note that `ifconfig` is becoming obsolete and being replaced by `ip`, which offers more features and capabilities.

View File

@@ -1,15 +0,0 @@
# Subnetting
Subnetting is a critical process in Linux networking. This practice involves dividing a network into two or more networks, known as subnets. Subnetting helps improve network performance and security. In Linux, subnetting can be managed within the context of the Internet Protocol (IP) addressing scheme, where it's crucial in organizing and managing IP addresses within a network, preventing IP conflicts and efficiently utilizing IP address ranges. This technique is invaluable in large complex Linux networking environments where IP address management can become overwhelmingly intricate.
Generally, the following commands are used in Linux for subnetting:
```shell
# Display current routing table
$ route -n
# Add a new subnet
$ route add -net xxx.xxx.xxx.x/xx gw yyy.yyy.yyy.y
```
Please replace the `xxx.xxx.xxx.x/xx` with your desired subnet address and network mask and replace `yyy.yyy.yyy.y` with the intended default gateway for the subnet.

View File

@@ -0,0 +1,13 @@
# Networking
Linux networking enables systems to connect and share resources across different platforms. It provides robust tools for managing network interfaces, troubleshooting, and automation. Network configurations are stored in files like `/etc/network/interfaces`. Common commands include `ifconfig` (deprecated) and `ip` for interface management. Linux networking supports various protocols and scales well.
Linux adopts a file-based approach for network configuration, storing network-related settings and configurations in standard files, such as /etc/network/interfaces or /etc/sysconfig/network-scripts/, depending on the Linux distribution.
Perhaps one of the most popular commands related to networking on a Linux system is the `ifconfig` command:
```bash
ifconfig
```
This will output information about all network interfaces currently active on the system. However, please note that `ifconfig` is becoming obsolete and being replaced by `ip`, which offers more features and capabilities.

View File

@@ -0,0 +1,7 @@
# NL (Number Lines)
The `nl` command numbers lines in text files, providing an overview of line locations. By default, it numbers only non-empty lines, but this behavior can be modified. Syntax: `nl [options] [file_name]`. If no file is specified, nl reads from stdin. Valuable for text processing when line numbers are needed for reference or debugging purposes.
Learn more from the following resources:
- [@article@Linux nl Command: Line Numbering](https://labex.io/tutorials/linux-linux-nl-command-line-numbering-210988)

View File

@@ -1,17 +0,0 @@
# Package Management
Package Management is a crucial concept in Linux that aids in the handling of packages (collections of files). It not only allows the user to install new software with single commands but also helps manage existing ones. This includes installing, updating, configuring, and removing software packages. Package management incorporates a standardized system that keeps track of every software's prerequisites and takes care of installation, updates and removal.
Linux distributions use various package managers. Some of the commonly used are `apt` (Advanced Packaging Tool) for Debian-based distributions, `yum` (Yellowdog Updater, Modified) and `dnf` (Dandified YUM) for Red-Hat-based distributions, and `pacman` for Arch Linux.
For instance, to install a package in a Debian-based distribution, you would use the following command in apt:
```bash
sudo apt install <package-name>
```
Such vital features have made package management systems an integral part of Linux distributions, allowing users to handle applications efficiently.
Learn more from the following resources:
- [@article@Software Installation on Linux](https://labex.io/tutorials/linux-software-installation-on-linux-18005)

View File

@@ -1,19 +0,0 @@
# Listing Installed Packages
Linux, known for its robustness and flexibility, provides several package managers that aid in software management. These package managers help us to install, update, or remove software in a systematic way. Each Linux distribution may come with its own package management system. Examples include `apt` in Debian-based systems, `dnf` in Fedora, `zypper` in OpenSUSE, and `pacman` in Arch Linux.
One common task you may often need is listing installed packages in your system. This task can help in various scenarios like auditing installed software, scripting or automating deployment of software on new machines.
Below is the command for listing installed packages in an `apt` package manager:
```shell
sudo apt list --installed
```
For `dnf` package manager, you would use:
```shell
dnf list installed
```
Remember, different distributions will have their own syntax for this command.

View File

@@ -1,12 +0,0 @@
# Snap
Snap is a modern approach to package management in Linux systems promoted by Canonical (the company behind Ubuntu). Unlike traditional package management systems such as dpkg or RPM, Snap focuses on providing software as self-contained packages (known as 'Snaps') that include all of their dependencies. This ensures that a Snap application runs consistently across a variety of different Linux distributions.
Snaps are installed from a Snapcraft store and are automatically updated in the background. The Snap update process is transactional, meaning if something goes wrong during an update, Snap can automatically revert to the previous working version.
Here is a simple example of a snap command:
```sh
sudo snap install [package-name]
```
In the command above, `[package-name]` is the name of the snap package you want to install. You must run this command as the superuser (sudo), as root privileges are needed to install packages.

View File

@@ -0,0 +1,7 @@
# Package Management
Package management handles software installation, updates, configuration, and removal in Linux. It manages collections of files and tracks software prerequisites automatically. Common package managers include `apt` (Debian-based), `yum`/`dnf` (Red Hat-based), and `pacman` (Arch). Example: `sudo apt install <package-name>` installs packages. Essential for efficient application management.
Learn more from the following resources:
- [@article@Software Installation on Linux](https://labex.io/tutorials/linux-software-installation-on-linux-18005)

View File

@@ -0,0 +1,11 @@
# Package Repositories
Package repositories are storage locations containing software packages for Linux distributions. They enable easy installation, updates, and dependency management through package managers like apt, yum, or dnf. Each distribution has pre-configured repositories with tested, secure packages. Use commands like `apt update` or `yum update` to sync with repositories.
```
sudo apt update # command to update the repository in Ubuntu
sudo yum update # command to update the repository in CentOS or Fedora
raco pkg update # command in Racket to update all installed packages
```
These repositories are what make Linux a force to reckon with when it comes to software management with an element of security ensuring that the users only install software that is secure and reliable.

View File

@@ -0,0 +1,11 @@
# Packet Analysis
Packet analysis is a key Linux network troubleshooting skill involving capturing and analyzing network traffic to identify performance issues, connectivity problems, and security vulnerabilities. Tools like tcpdump and Wireshark provide packet-level details for network diagnostics. Use `sudo tcpdump -i eth0` to capture packets on the eth0 interface for debugging network protocols.
A basic example of using tcpdump to capture packets in a Linux system command might look like this:
```sh
sudo tcpdump -i eth0
```
This command captures and displays packets being transmitted or received over the `eth0` network interface.

Some files were not shown because too many files have changed in this diff Show More