Introduction to Linux
Linux is a powerful, open-source operating system widely used in servers, cloud platforms, development environments, and even personal computers. It provides users with complete control over their system through the command line.
Why Learn Linux?
- Free and open-source operating system
- Powers most servers and cloud platforms
- Essential skill for DevOps, Cloud, and System Admin roles
- Highly secure and stable
- Gives full control via the command line
- High demand in IT and software industries
Linux Basics
Linux is a Unix-like operating system kernel. It is a free and open-source software project that has become the foundation for many operating systems, including Ubuntu, Fedora, and CentOS.
Linux is built around a kernel, which manages hardware and system resources. Users interact with Linux using a shell, commonly through the command line interface (CLI).
File System Structure
Linux follows a hierarchical file system.
/: Root directory
/home: User home directories
/etc: Configuration files
/var: Variable data (logs, databases)
/bin & /usr/bin: User programs and utilities
/tmp: Temporary files
Basic Linux Commands
These are fundamental commands used in the Linux terminal:
ls: List directory contents
cd: Change directory
pwd: Print working directory
mkdir: Create a new directory
rm: Remove files or directories
cp: Copy files or directories
mv: Move or rename files or directories
File Permissions & Ownership
Linux uses a permission system to control access to files and directories.
1. Read (r) - allows reading the file or listing directory contents.
2. Write (w) - allows modifying the file or creating/deleting files in a directory.
3. Execute (x) - allows executing a file or entering a directory.
Use chmod to change permissions and chown to change ownership.
Note: Permissions are assigned to three categories: Owner, Group, and Others.
User & Group Management
Linux supports multiple users and groups.
Function Declaration
whoami: Show current user
adduser / useradd: Create a new user
passwd: Change password
groups: Show user groups
Process Management
Monitor and control running processes:
ps: Show running processes
kill: Terminate a process
top: Display real-time system processes
htop: Advanced process viewer
Package Management
Install and manage software easily.
apt: Debian/Ubuntu
yum / dnf: RedHat/CentOS
Examples:
sudo apt update
sudo apt install nginx
Networking Commands
Check network and connectivity.
ip a: Show IP address
ping: Test connectivity
netstat / ss: Network statistics
curl / wget: Download data
Shell Scripting Basics
Automate tasks using shell scripts.
• Variables and conditions
• Loops
• Basic automation
Shell scripting helps save time and reduce manual work.
Best Practices & Tips
✓ Use sudo carefully
✓ Regularly update your system
✓ Avoid running commands blindly
✓ Avoid running commands blindly
✓ Keep backups of important data