Understanding Linux: A Comprehensive Guide for Beginners
Linux is an open-source operating system that is widely known for its flexibility, security, and diverse distributions (often called "flavors"). This guide will walk you through the fundamentals of Linux, covering essential concepts, commands, permissions, user management, and more.
What is Linux?
Linux is an open-source operating system kernel that serves as the foundation for various operating systems known as Linux distributions (distros). It provides a robust and secure environment for servers, desktops, and embedded systems.
Levels of Access in Linux
User Level: Regular users with limited permissions.
Root Level: The superuser with complete control over the system.
Service Accounts: Specialized accounts for running services and daemons.
Security in Linux
Linux is known for its security features, which include:
User Permissions: Users are restricted by file permissions (read, write, execute).
Firewall Rules: Control incoming and outgoing network traffic using inbound and outbound rules.
Public and Private Keys: Asymmetric encryption for secure communication.
Ease of Use & Popular Flavors of Linux
Linux offers various distributions (distros) catering to different needs:
Ubuntu: User-friendly and widely used for desktops.
CentOS: Ideal for servers with long-term support.
Debian: Known for stability and robustness.
RHEL (Red Hat Enterprise Linux): Enterprise-grade distro with professional support.
Arch Linux: A lightweight and flexible option for advanced users.
Linux Architecture
Here's a breakdown of Linux system architecture:
Hardware (H/W): The physical components like CPU, RAM, and storage.
Kernel: The core of the OS, responsible for process management, device management, memory management, etc.
System Libraries: Libraries that support system utilities and applications.
System Utilities: Essential tools for system administration.
User Applications: Software like browsers, editors, etc.
Private Key vs. Public Key
Public Key: Shared with anyone for encryption.
Private Key: Kept secret for decryption. Example: SSH uses these keys for secure communication.
Ports: The Entry and Exit Points
Think of ports as doors and windows for your system:
Inbound Rules: Control incoming connections (like opening a door).
Outbound Rules: Control outgoing connections (like opening a window).
Basic Linux Commands
File and Directory Commands
ls
: List directory contents.$ ls Documents Downloads Pictures
pwd
: Print current working directory.$ pwd /home/ubuntu
mkdir
: Create a new directory.$ mkdir new_folder
touch
: Create an empty file.$ touch newfile.txt
cat
: Display contents of a file.$ cat filename.txt Hello, World!
mv
: Move or rename a file.$ mv oldname.txt newname.txt
Updating System Packages
Ubuntu:
$ sudo apt update
CentOS:
$ sudo yum update
Using Snap (Ubuntu):
$ sudo snap install <package>
User Management in Linux
Creating Users and Managing Groups
Creating a new user:
$ sudo useradd newuser
useradd
uses the/bin/sh
shell by default.
Switching to Root User:
$ sudo su
Checking User Information:
$ cat /etc/passwd ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash
userid
andgroupid
are listed here.
Adding a user to a group:
$ sudo usermod -aG docker $USER
After adding, refresh the group membership:
$ newgrp docker
addgroup
vsgroupadd
: Both are used to create groups butaddgroup
is a Debian-specific variant with more user-friendly prompts.
Understanding File Permissions
Permission Levels:
r
(read) = 4w
(write) = 2x
(execute) = 1
Example of File Permissions:
$ ls -l -rw-rw-r-- 1 ubuntu ubuntu 4096 Nov 10 10:00 file.txt
rw-
for Owner (User)rw-
for Groupr--
for Others
๐ Essential Linux Commands
1. Viewing and Manipulating Files
$ cat file.txt # Display file contents
$ mv oldname.txt newname.txt # Rename or move a file
$ rm filename.txt # Delete a file
$ cp source.txt destination.txt # Copy a file
2. System Monitoring
$ ps -aux # Display all running processes
$ top # Monitor system resources in real-time
$ sleep 100 # Pause terminal for 100 seconds
3. Using vi
Text Editor
$ vi myfile.txt
# Press 'i' to enter insert mode
# Type your content
# Press 'ESC', then type ':wq' to save and exit
4. Viewing System Information
$ uname -a # Display system information
$ df -h # Show disk usage
$ free -m # Display memory usage
๐๏ธ Important Directories in Linux
Directory | Description |
/etc | Configuration files |
/home | User home directories |
/var | Variable data (e.g., logs) |
/opt | Optional software packages |
Subscribe to my newsletter
Read articles from Krishnat Ramchandra Hogale directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Krishnat Ramchandra Hogale
Krishnat Ramchandra Hogale
Hi! Iโm Krishnat, a Senior IT Associate specializing in Performance Engineering at NTT DATA SERVICES. With experience in cloud technologies, DevOps, and automation testing, I focus on optimizing CI/CD pipelines and enhancing infrastructure management. Currently, I'm expanding my expertise in DevOps and AWS Solutions Architecture, aiming to implement robust, scalable solutions that streamline deployment and operational workflows.