محاضرة 8
Linux Comprehensive Revision Guide
مراجعة شاملة للأساسيات، المستخدمين، الأوامر، وتراخيص الملفات.
يلا نشوف الملخص
Linux Comprehensive Revision Guide (Lectures 1-7)
1. Introduction to Linux & OS Concepts
- Operating System (OS): An OS manages hardware and software, acting as a bridge between the user and the physical computer.
- Layers: User ↔ Applications ↔ OS (Kernel) ↔ Hardware.
- The Kernel: The core of Linux that manages CPU, Memory (RAM), and devices. Hardware drivers in Linux are called Modules.
- Distributions (Distros): A complete OS package including the Kernel, GNU tools (Shell/Terminal), a Graphical Environment (Gnome, KDE), and a Package Manager (YUM, DNF).
- Advantages: Linux is Costless, Open Source, Stable, and Highly Secure.
2. Command Line Interface (CLI) Basics
- CLI vs GUI: CLI is text-based and essential for advanced tasks and server management.
- Terminal: The window where you type.
- Shell: The program that executes your commands (e.g., Bash).
- Essential Commands:
whoami: Current logged-in user.pwd: Print Working Directory (where am I?).ls: List files and folders.cd: Change directory (cd ..to go back,cd /for root).mkdir: Create a new folder.rm/rmdir: Delete files or empty folders.cp/mv: Copy or Move/Rename files.man [command]: View manual for a command.
3. Text File Manipulation
touch: Create an empty file.cat: Display file content.echo: Write text to a file (>overwrites,>>appends).nano: Simple terminal text editor (Ctrl+O to save, Ctrl+X to exit).- Searching:
find: Search for file names (e.g.,find . -name "*.txt").grep: Search for text inside files (e.g.,grep "error" log.txt).
- Viewing:
less(scrollable),head(first lines),tail(last lines),tail -f(real-time monitoring).
4. User and Group Management (CLI)
- Users:
sudo useradd -m username: Create user with a home directory.sudo passwd username: Set/change password.sudo userdel -r username: Delete user and their files./etc/passwd: File containing user information.
- Groups:
sudo groupadd groupname: Create a group.sudo usermod -aG groupname username: Add user to a group.groups username: See which groups a user belongs to./etc/group: File containing group information.
5. File Permissions (chmod)
- Structure:
[Type] [User] [Group] [Others](e.g.,- rwx r-x r--). - Numeric (Absolute) Mode:
- Read (4), Write (2), Execute (1).
7(4+2+1) = rwx6(4+2) = rw-5(4+1) = r-x4= r--
- Examples:
chmod 755 file: Full for user, read/execute for others.chmod 644 file: Read/write for user, read-only for others.
6. Disk Partitioning (fdisk)
- Partition Types:
- Primary: Max 4 per disk, bootable.
- Extended: Holds multiple Logical partitions.
- Process to use a new disk:
- Create Partition:
fdisk /dev/sdb(Commands:nfor new,wto save). - Format:
mkfs -t ext4 /dev/sdb1(Creates the filesystem). - Mount:
mount /dev/sdb1 /mnt/data(Attaches it to a directory).
- Create Partition:
- Verification:
df -hTshows mounted disks and their sizes.
في نقطة مش واضحة؟ بطبط موجود!
اسأل بطبط عنها