🔹 1. Introduction to Linux CLI
• What is the CLI?: Overview of the Command Line Interface
• CLI vs GUI: Differences between Command Line Interface and Graphical User Interface
• Why Use CLI?: Advantages of using the command line (speed, automation, flexibility)
• Accessing the CLI: Using terminal emulators in Linux (gnome-terminal, xterm, Konsole)
• CLI Syntax: Basic structure of commands (command, options, arguments)
________________________________________
🔹 2. Basic Linux Commands
• pwd (Print Working Directory): Displaying the current directory
• ls (List): Listing files and directories
o ls -l: Detailed listing (permissions, sizes, etc.)
o ls -a: Show hidden files
• cd (Change Directory): Navigating between directories
o cd ~: Going to the home directory
o cd ..: Moving up one directory level
• mkdir (Make Directory): Creating directories
• rmdir (Remove Directory): Removing empty directories
• rm (Remove Files): Deleting files
o rm -r: Remove directories and their contents
• touch: Creating empty files
• cp (Copy): Copying files and directories
• mv (Move): Moving files or renaming them
________________________________________
🔹 3. File and Directory Permissions
• Understanding Permissions: Read, Write, and Execute permissions (r, w, x)
• chmod (Change Mode): Changing file permissions
o chmod 755: Common permissions for scripts
o chmod u+x filename: Giving execute permission to the user
• chown (Change Ownership): Changing file ownership
o chown user:group filename: Changing file owner and group
• ls -l: Viewing file permissions
________________________________________
🔹 4. Managing Files and Directories
• Finding Files: Using find to search for files in directories
o find /path/to/search -name filename
• File Compression and Decompression:
o tar (tarballs): Creating and extracting tar files
o zip / unzip: Creating and extracting zip files
o gzip / gunzip: Compressing and decompressing files
• File Editing:
o nano: A simple text editor
o vim: A more advanced text editor
• Viewing Files:
o cat: Display contents of a file
o less: View content page by page
o more: View file content one screen at a time
o head: View the top part of a file
o tail: View the end of a file
________________________________________
🔹 5. File Searching and Manipulation
• grep (Global Regular Expression Print): Searching within files using patterns
o grep "pattern" filename: Search for a pattern in a file
o grep -r "pattern" directory: Recursive search in a directory
• locate: Finding files using a pre-built index
o locate filename
• find: Search for files based on specific criteria
o find /path -name "*.txt": Find all .txt files in a directory
________________________________________
🔹 6. Process Management
• ps (Process Status): Viewing active processes
o ps aux: Viewing all running processes
• top: Interactive view of system processes and resource usage
• kill: Terminating processes by PID
o kill <PID>
o killall <process-name>: Killing processes by name
• jobs: Viewing background jobs
• bg: Resuming a job in the background
• fg: Bringing a job to the foreground
________________________________________
🔹 7. System Monitoring and Resource Usage
• free: Viewing system memory usage
• df (Disk Free): Viewing disk space usage
o df -h: Showing disk usage in human-readable format
• du (Disk Usage): Checking file or directory disk usage
o du -sh: Summary of disk usage in human-readable format
• uptime: Showing system uptime and load
• vmstat: Monitoring virtual memory statistics
________________________________________
🔹 8. Networking Commands
• ifconfig / ip: Displaying or configuring network interfaces
• ping: Checking network connectivity to a host
• netstat: Viewing network connections and open ports
• curl: Transfer data from or to a server (HTTP requests)
• wget: Download files from the web
• ssh: Secure shell for remote access
o ssh username@hostname: Connecting to a remote system via SSH
• scp (Secure Copy): Copy files between local and remote systems
o scp file user@hostname:/path/to/destination
________________________________________
🔹 9. Package Management
• APT (Advanced Package Tool): Package manager for Debian-based distributions (Ubuntu, Debian)
o apt update: Updating package index
o apt upgrade: Upgrading installed packages
o apt install package-name: Installing a package
o apt remove package-name: Removing a package
• YUM: Package manager for RPM-based distributions (CentOS, Fedora)
o yum install package-name: Installing packages
o yum update: Updating all packages
• dpkg: Debian package manager (for Debian-based systems)
o dpkg -i package-name.deb: Installing .deb packages
________________________________________
🔹 10. System Administration
• sudo: Executing commands with superuser privileges
• useradd: Adding a new user to the system
o useradd username
• passwd: Changing a user's password
• usermod: Modifying a user's account settings
o usermod -aG groupname username: Adding a user to a group
• groupadd: Adding new groups
• chroot: Changing the root directory for a process
• reboot / shutdown: Restarting or shutting down the system
• systemctl: Managing system services (starting, stopping, enabling)
________________________________________
🔹 11. Shell Scripting
• Creating Shell Scripts: Writing and executing shell scripts
o chmod +x script.sh: Making a script executable
• Variables and Functions: Using variables, functions, and arguments
• Control Structures: if, else, while, for, case
• Loops: Writing for, while, and until loops
• Pipes and Redirection: Using |, >, <, >> to manipulate command output
• Scheduling Tasks: Using cron to automate tasks
________________________________________
🔹 12. Disk Management
• fdisk: Partitioning hard drives
• mount: Mounting filesystems
• umount: Unmounting filesystems
• lsblk: Listing block devices (disks, partitions, etc.)
• parted: Another tool for partitioning disks
• mkfs: Formatting disks with different file systems (e.g., ext4, NTFS)
________________________________________
🔹 13. User and Group Management
• groupadd: Adding a new group
• groupdel: Deleting a group
• usermod: Modifying user details
• gpasswd: Administering the group password
• chown: Changing ownership of files and directories
• chmod: Changing file permissions
• passwd: Changing user passwords
________________________________________
🔹 14. Backup and Recovery
• tar: Backing up and compressing files into .tar archives
o tar -czvf archive.tar.gz folder/
• rsync: Efficient file backup and synchronization
o rsync -av source/ destination/
• dd: Disk cloning and backup
o dd if=/dev/sda of=/dev/sdb bs=64K conv=noerror,sync
________________________________________
🔹 15. Advanced Topics
• SELinux: Security-Enhanced Linux for managing security policies
• Systemd: Managing system services and boot processes
• LVM (Logical Volume Management): Advanced disk management
• Docker: Containerization and managing containerized applications
________________________________________
🔹 16. Troubleshooting and Diagnostics
• dmesg: Viewing system logs and hardware information
• journalctl: Viewing and analyzing logs in systemd systems
• strace: Tracing system calls and debugging applications
• lsof: Listing open files and their associated processes