LINUX
01 July 2025 13:34
🐧 What is Linux?
• Linux is an Operating System (OS) — like Windows or macOS.
• But unlike them, Linux is open-source, meaning it's free and its code is publicly available.
• Linux is used in servers, cloud computing, mobile (Android), embedded systems, and DevOps
tools.
🧱 Basic Components of Linux OS
Component Explanation
Kernel The core part of Linux that talks to hardware (like CPU, RAM, disks).
Shell A program that lets you interact with the OS via commands.
File System Organizes and stores data. Everything in Linux is treated as a file (even devices).
GUI Optional — Linux can have graphical interfaces like GNOME or KDE, but often used via
terminal.
📁 Linux Directory Structure
Linux starts with root (/) directory. Below it, there are folders with fixed purposes:
Directory Purpose
/ Root of the file system
/home User folders (like C:\Users)
/bin Essential command binaries (like ls, cp, mv)
/etc System config files
/var Variable files (like logs)
/tmp Temporary files
/usr User programs and libraries
/root Home directory of the root (admin) user
/dev Device files (like USB, hard disks)
/proc System and process info (virtual folder)
💻 Basic Linux Commands
Command Use
pwd Show current directory
ls List files and folders
cd Change directory
mkdir Make a directory
touch Create an empty file
cp Copy files/folders
Basic info Page 1
,mv Move or rename files
rm Delete files
cat Show file contents
clear Clear the terminal
exit Close the terminal or shell
👤 User and Permissions
Linux is multi-user. Every file and folder has permissions and ownership.
Users:
• root: Superuser (admin)
• Normal users: Limited access
Permissions:
• Each file has 3 types of permissions for:
○ Owner
○ Group
○ Others
Permission types:
• r → read
• w → write
• x → execute
Example:
-rwxr-xr-- 1 user group 1234 Jul 1 file.sh
Breakdown:
• -rwxr-xr--
○ rwx (owner): full permission
○ r-x (group): read & execute
○ r-- (others): read only
🧠 Package Management (Installing Software)
• Ubuntu/Debian-based:
○ apt-get install <package-name>
• Red Hat/CentOS:
○ yum install <package-name> or dnf install
• Others: May use pacman, zypper, snap, flatpak
🔍 Processes and System Monitoring
Command Description
ps Show running processes
top Live view of system usage (CPU, memory)
kill Stop a process
htop Better version of top (if installed)
🧰 File Compression and Archiving
Command Description
tar -cvf Create archive
Basic info Page 2
,tar -cvf Create archive
tar -xvf Extract archive
gzip, gunzip Compress and decompress files
🔑 Important Concepts
Concept Meaning
Shell Script A file with commands you can execute like a program (.sh)
Cron Job Schedule a task to run automatically
Log files Located in /var/log, useful for troubleshooting
SSH Remote login to a Linux machine (ssh user@ip)
Sudo Temporarily run commands as root user (sudo <command>)
⚙ How It Helps in DevOps
Linux is the foundation of:
• Cloud servers (AWS EC2, GCP, Azure)
• CI/CD pipelines
• Docker & Kubernetes
• Automation tools like Ansible, Terraform
📘 What Are CRUD Operations?
CRUD stands for:
• C – Create
• R – Read
• U – Update
• D – Delete
In Linux, CRUD operations can be performed on:
• Files
• Directories
• File content
• System records (like user data or processes)
🟩 C – CREATE Operations in Linux
➤ Create a File
touch filename.txt
Example:
touch notes.txt
➤ Create a File with Content
echo "Hello, Linux!" > hello.txt
OR
cat > data.txt
Type your content
Press Ctrl+D to save
➤ Create a Directory (Folder)
mkdir foldername
Example:
Basic info Page 3
, Example:
mkdir projects
➤ Create Nested Directories
mkdir -p devops/scripts/yaml
🟦 R – READ Operations in Linux
➤ View File Content
cat filename.txt
less filename.txt # Scrollable
more filename.txt # Page-wise output
➤ View First or Last Lines
head filename.txt # First 10 lines
tail filename.txt # Last 10 lines
➤ Read a Directory
ls # List files
ls -l # Detailed view
ls -a # Show hidden files
➤ Read a Specific Line (Using sed or awk)
sed -n '3p' filename.txt # Show 3rd line
awk 'NR==3' filename.txt # Another method
🟨 U – UPDATE Operations in Linux
➤ Append to File
echo "New line" >> file.txt
➤ Edit File (Using Editors)
• nano filename.txt – beginner-friendly terminal editor
• vim filename.txt – powerful but advanced editor
➤ Replace Text in File
sed -i 's/oldtext/newtext/g' filename.txt
Example:
sed -i 's/Devops/Linux DevOps/g' notes.txt
➤ Rename File or Folder
mv oldname.txt newname.txt
➤ Move File to Different Location
mv file.txt /home/user/docs/
🟥 D – DELETE Operations in Linux
➤ Delete a File
rm filename.txt
➤ Delete a Directory
rm -r foldername
➤ Force Delete
rm -rf foldername
⚠
Basic info Page 4
01 July 2025 13:34
🐧 What is Linux?
• Linux is an Operating System (OS) — like Windows or macOS.
• But unlike them, Linux is open-source, meaning it's free and its code is publicly available.
• Linux is used in servers, cloud computing, mobile (Android), embedded systems, and DevOps
tools.
🧱 Basic Components of Linux OS
Component Explanation
Kernel The core part of Linux that talks to hardware (like CPU, RAM, disks).
Shell A program that lets you interact with the OS via commands.
File System Organizes and stores data. Everything in Linux is treated as a file (even devices).
GUI Optional — Linux can have graphical interfaces like GNOME or KDE, but often used via
terminal.
📁 Linux Directory Structure
Linux starts with root (/) directory. Below it, there are folders with fixed purposes:
Directory Purpose
/ Root of the file system
/home User folders (like C:\Users)
/bin Essential command binaries (like ls, cp, mv)
/etc System config files
/var Variable files (like logs)
/tmp Temporary files
/usr User programs and libraries
/root Home directory of the root (admin) user
/dev Device files (like USB, hard disks)
/proc System and process info (virtual folder)
💻 Basic Linux Commands
Command Use
pwd Show current directory
ls List files and folders
cd Change directory
mkdir Make a directory
touch Create an empty file
cp Copy files/folders
Basic info Page 1
,mv Move or rename files
rm Delete files
cat Show file contents
clear Clear the terminal
exit Close the terminal or shell
👤 User and Permissions
Linux is multi-user. Every file and folder has permissions and ownership.
Users:
• root: Superuser (admin)
• Normal users: Limited access
Permissions:
• Each file has 3 types of permissions for:
○ Owner
○ Group
○ Others
Permission types:
• r → read
• w → write
• x → execute
Example:
-rwxr-xr-- 1 user group 1234 Jul 1 file.sh
Breakdown:
• -rwxr-xr--
○ rwx (owner): full permission
○ r-x (group): read & execute
○ r-- (others): read only
🧠 Package Management (Installing Software)
• Ubuntu/Debian-based:
○ apt-get install <package-name>
• Red Hat/CentOS:
○ yum install <package-name> or dnf install
• Others: May use pacman, zypper, snap, flatpak
🔍 Processes and System Monitoring
Command Description
ps Show running processes
top Live view of system usage (CPU, memory)
kill Stop a process
htop Better version of top (if installed)
🧰 File Compression and Archiving
Command Description
tar -cvf Create archive
Basic info Page 2
,tar -cvf Create archive
tar -xvf Extract archive
gzip, gunzip Compress and decompress files
🔑 Important Concepts
Concept Meaning
Shell Script A file with commands you can execute like a program (.sh)
Cron Job Schedule a task to run automatically
Log files Located in /var/log, useful for troubleshooting
SSH Remote login to a Linux machine (ssh user@ip)
Sudo Temporarily run commands as root user (sudo <command>)
⚙ How It Helps in DevOps
Linux is the foundation of:
• Cloud servers (AWS EC2, GCP, Azure)
• CI/CD pipelines
• Docker & Kubernetes
• Automation tools like Ansible, Terraform
📘 What Are CRUD Operations?
CRUD stands for:
• C – Create
• R – Read
• U – Update
• D – Delete
In Linux, CRUD operations can be performed on:
• Files
• Directories
• File content
• System records (like user data or processes)
🟩 C – CREATE Operations in Linux
➤ Create a File
touch filename.txt
Example:
touch notes.txt
➤ Create a File with Content
echo "Hello, Linux!" > hello.txt
OR
cat > data.txt
Type your content
Press Ctrl+D to save
➤ Create a Directory (Folder)
mkdir foldername
Example:
Basic info Page 3
, Example:
mkdir projects
➤ Create Nested Directories
mkdir -p devops/scripts/yaml
🟦 R – READ Operations in Linux
➤ View File Content
cat filename.txt
less filename.txt # Scrollable
more filename.txt # Page-wise output
➤ View First or Last Lines
head filename.txt # First 10 lines
tail filename.txt # Last 10 lines
➤ Read a Directory
ls # List files
ls -l # Detailed view
ls -a # Show hidden files
➤ Read a Specific Line (Using sed or awk)
sed -n '3p' filename.txt # Show 3rd line
awk 'NR==3' filename.txt # Another method
🟨 U – UPDATE Operations in Linux
➤ Append to File
echo "New line" >> file.txt
➤ Edit File (Using Editors)
• nano filename.txt – beginner-friendly terminal editor
• vim filename.txt – powerful but advanced editor
➤ Replace Text in File
sed -i 's/oldtext/newtext/g' filename.txt
Example:
sed -i 's/Devops/Linux DevOps/g' notes.txt
➤ Rename File or Folder
mv oldname.txt newname.txt
➤ Move File to Different Location
mv file.txt /home/user/docs/
🟥 D – DELETE Operations in Linux
➤ Delete a File
rm filename.txt
➤ Delete a Directory
rm -r foldername
➤ Force Delete
rm -rf foldername
⚠
Basic info Page 4