0% found this document useful (0 votes)
5 views

Lec3_Intro_to_Linux

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lec3_Intro_to_Linux

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Introduction to Linux

system
Introduction to Linux

´ Overview:
´ Linux: A powerful operating system based on Unix, widely used due to its flexibility
and robustness.
´ History: Developed by Linus Torvalds in 1991, Linux has become a key player in
operating systems.
´ Features:
´ Open-source: The source code is freely available for anyone to view, modify,
and distribute. This fosters a large community contributing to its development.
´ Secure: Linux is known for its strong security features, including robust user
permissions and regular security updates.
´ Versatile: Runs on a variety of hardware, from servers and desktops to
smartphones and embedded devices. Linux powers much of the internet
infrastructure and is popular in cloud computing.
Linux File System

´ Structure:
´ Hierarchical Directory: Linux uses a tree-like structure starting at the root directory (/).
All files and directories are contained within this hierarchy.
´ Root Directory (/): The top-level directory where the entire file system hierarchy starts.
´ Key Directories:
´ /home: Contains personal directories for each user, where users can store personal
files and settings.
´ /etc: Holds configuration files for the system and installed applications. It's where
system-wide configuration files reside.
´ /var: Contains variable data like logs, caches, and temporary files that change over
time.
´ /bin: Includes essential binary executables needed for booting and system operation,
such as basic commands and utilities.
Navigating the File System

´ Command: ls
´ Usage: Lists files and directories.
´ Options:
´ -l: Detailed view (permissions, owner, size).
´ -a: Includes hidden files (files starting with a dot).

´ Command: pwd
´ Usage: Displays current directory path.
Viewing and Editing Files

´ Command: cat
´ Usage: Concatenates and displays file contents.
´ Command: nano or vi
´ Usage: Text editors within the terminal.
´ nano: User-friendly with on-screen help.
´ vi: More powerful, but steeper learning curve.
File Management

´ Command: cp
´ Usage: Copies files or directories.
´ Example: cp source.txt destination.txt.
´ Command: mv
´ Usage: Moves or renames files.
´ Example: mv oldname.txt newname.txt.
´ Command: rm
´ Usage: Removes files.
´ Example: rm file.txt.
Directory Management

´ Command: mkdir
´ Usage: Creates a new directory.
´ Example: mkdir new_folder.
´ Command: rmdir
´ Usage: Removes an empty directory.
´ Example: rmdir old_folder.
Permissions and Ownership

´ Command: chmod
´ Usage: Changes file permissions.
´ Example: chmod 755 script.sh.
´ Command: chown
´ Usage: Changes file owner.
´ Example: chown user:group file.txt.
System Information

´ Command: uname
´ Usage: Displays system information.
´ Example: uname -a for all details.
´ Command: df
´ Usage: Shows disk space usage.
´ Example: df -h for human-readable format.
Process Management

´ Command: ps
´ Usage: Displays current processes.
´ Example: ps aux for detailed view.
´ Command: kill
´ Usage: Terminates a process.
´ Example: kill 1234 (where 1234 is the process ID).
Networking Commands

´ Command: ifconfig or ip
´ Usage: Configures network interfaces.
´ Example: ip addr for IP addresses.
´ Command: ping
´ Usage: Tests connectivity to a host.
´ Example: ping google.com.
Package Management

´ Command: apt (Debian-based systems)


´ Usage: Manages software packages.
´ Example: apt update and apt install package.
´ Command: yum or dnf (Red Hat-based systems)
´ Usage: Manages software packages.
´ Example: yum install package.
Additional Basic Commands

´ Command: touch
´ Usage: Create an empty file.
´ Example: touch newfile.txt.
´ Command: grep
´ Usage: Search text using patterns.
´ Example: grep 'pattern' file.txt.
´ Command: find
´ Usage: Search for files in a directory.
´ Example: find / -name filename.
Comparing Linux Distributions

´ Overview:
´ Linux Distributions (Distros): Variants of Linux tailored for different user needs,
each with unique features and objectives.
´ Purpose of Distros: Provide users with specific tools, interfaces, and configurations
suited to different use cases, from desktops to servers.
´ Common Features:
´ Kernel: All distributions are based on the Linux kernel, which manages hardware
resources and system processes.
´ Package Manager: Each distro comes with a package manager to install,
update, and manage software. Examples include apt for Debian-based systems
and yum/dnf for Red Hat-based systems.
Cont.

´ Common Features:
´ Desktop Environment: The graphical interface users interact with. Options include
GNOME, KDE, XFCE, and others, providing various levels of customization and
resource usage.
´ Types of Distributions:
´ General-purpose: Suitable for everyday use, such as Ubuntu and Fedora, offering
a balance of features and ease of use.
´ Enterprise: Focused on stability and long-term support, such as CentOS and Red
Hat Enterprise Linux, often used in corporate environments.
´ Lightweight: Designed for performance on older or resource-constrained
hardware, such as Lubuntu or Puppy Linux.
Cont.

´ Types of Distributions:
´ Security-focused: Tailored for security professionals, featuring tools for
penetration testing and forensics, like Kali Linux.
´ Choosing a Distribution:
´ User Experience: Consider ease of use, community support, and available
documentation.
´ Purpose: Match the distribution to your specific needs, whether it's for personal
use, development, servers, or security.
´ Support and Community: Larger communities offer more resources, forums, and
tutorials, which can be crucial for troubleshooting and learning.
Popular Linux Distributions

´ Ubuntu: User-friendly, strong community.


´ Fedora: Cutting-edge, frequent updates.
´ Debian: Stability, large package repository.
Specialized Distributions

´ Arch Linux: Customizable, rolling release.


´ Kali Linux: Security tools for professionals.
´ CentOS: Stability for enterprise use.
Best Linux for:

´ Best Linux Distribution for Beginners


´ Recommendation: Ubuntu
´ Reasons: Easy setup, community support, regular updates.
´ Best Linux Distribution for Advanced Users
´ Recommendation: Arch Linux
´ Reasons: Customization, latest software, strong community.
´ Best Linux Distribution for Servers
´ Recommendation: Debian
´ Reasons: Stability, long-term support, extensive packages.
Linux Services

´ Overview:
´ Services (daemons) are background processes that perform essential tasks.
´ Linux services provide essential capabilities for server and network management.
´ Understanding and configuring these services is crucial for system administrators.
´ Purpose:
´ Enable functionality like web hosting, file sharing, and system monitoring.
´ Advice:
´ Evaluate your needs to choose the right services.
´ Regularly monitor and update services for security and efficiency.
Web Server Services

´ Apache:
´ Function: Hosts websites and serves web pages over HTTP/HTTPS.
´ Features:
´ Modular Architecture: Highly customizable with modules for authentication, SSL, URL rewriting,
and more.
´ Supports Dynamic Content: Modules like mod_php allow integration with PHP, Python, and Perl.

´ Popular for Static and Dynamic Content: Used widely for both static sites and dynamic
applications.

´ Commands:
´ Install:
´ sudo apt install apache2 (Debian/Ubuntu),

´ sudo yum install httpd (CentOS/RHEL)


Cont.

´ Commands:
´ Start Service:
´ sudo systemctl start apache2 (Ubuntu)
´ sudo systemctl start httpd (CentOS)

´ Check Status: sudo systemctl status apache2 or httpd


´ Enable at Boot: sudo systemctl enable apache2 or httpd
´ NGINX
´ Function: A high-performance web server and reverse proxy for handling many concurrent
connections.
´ Features:
´ Event-driven Architecture: Efficient for high-traffic sites with lower memory usage.
´ Load Balancing and Caching: Provides load balancing for web applications and can act as a reverse
proxy.
´ Use Cases: Static content hosting, reverse proxy for backend services.
Cont.

´ Commands:
´ Install:
´ sudo apt install nginx (Debian/Ubuntu)
´ sudo yum install nginx (CentOS/RHEL)

´ Start Service: sudo systemctl start nginx


´ Check Status: sudo systemctl status nginx
´ Enable at Boot: sudo systemctl enable nginx
Database Services

´ MySQL/MariaDB:
´ Function: Relational database management system for handling structured data.
´ Features:
´ High Performance and Scalability: Widely used for websites and applications requiring high transaction
rates.
´ Supports Replication and Clustering: Ensures high availability and load balancing.
´ SQL Compatibility: Runs SQL queries for database operations.
´ Commands:
´ Install:
´ sudo apt install mysql-server (Debian/Ubuntu)
´ sudo yum install mariadb-server (CentOS/RHEL)

´ Start Service: sudo systemctl start mysql or mariadb


´ Access MySQL Shell: mysql -u root –p
´ Enable at Boot: sudo systemctl enable mysql or mariadb
Cont.

´ PostgreSQL:
´ Function: Advanced open-source relational database system supporting complex operations.
´ Features:
´ Supports Advanced Queries: Suited for large datasets with complex queries.
´ Extensible: Supports custom functions, data types, and indexing techniques.
´ ACID Compliant: Reliable data transactions, widely used in analytics and scientific applications.
´ Commands:
´ Install:
´ sudo apt install postgresql (Debian/Ubuntu)

´ sudo yum install postgresql-server (CentOS/RHEL)

´ Start Service: sudo systemctl start postgresql


´ Access PostgreSQL Shell: psql -U postgres
´ Enable at Boot: sudo systemctl enable postgresql
Security Services

´ SSH (Secure Shell):


´ Function: Provides encrypted remote access for secure logins and file transfers.
´ Features:
´ Encryption: Protects data and credentials.
´ Key-based Authentication: Strong security with SSH keys.
´ Port Forwarding: For secure tunneling and accessing internal networks.

´ Commands:
´ Start Service: sudo systemctl start ssh
´ Connect to Remote System: ssh user@hostname
´ Generate SSH Key Pair: ssh-keygen -t rsa -b 4096
Cont.

´ Firewall (iptables/nftables):
´ Function: Controls network traffic, manages rules for incoming/outgoing
connections.
´ Features:
´ Rule-based Traffic Control: Configure specific traffic rules to protect servers.
´ Highly Configurable: Supports complex rule sets for different network zones.

´ Commands:
´ Add Rule: sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT (for iptables)
´ List Rules: sudo iptables -L (iptables), sudo nft list ruleset (nftables)
´ Save Rules: sudo iptables-save > /etc/iptables/rules.v4
Conclusion

´ These slides provide foundational knowledge about what Linux is, its core
attributes, and how its file system is organized, setting the stage for
understanding basic commands and distributions.
´ Also we have an overview of key Linux services, explaining their functions
and features, which are crucial for managing and deploying Linux systems
effectively.
´ This slide provides a comprehensive overview of what Linux distributions are
and how they differ, helping users understand the landscape and make
informed choices.
References

´ Online Resources:
´ Linux Documentation Project
´ Ubuntu Official Documentation
´ ArchWiki
´ Books:
´ "The Linux Command Line" by William Shotts
´ "Linux Pocket Guide" by Daniel J. Barrett

You might also like