Linux Quickstart — Complete Summary


1. Linux Introduction

What is Linux

Linux is an open-source operating system widely used for servers, development, DevOps, and cloud infrastructure.

Why Linux

Reasons Linux is popular:

  • Open Source
  • Strong community support
  • Highly customizable
  • Most servers run on Linux
  • DevOps tools mainly support Linux
  • Automation friendly
  • Highly secure

Linux Architecture (Basic Idea)

Linux OS architecture generally consists of:

Applications
Shell
Kernel
Hardware
  • Applications – Programs like browsers, editors.
  • Shell – Interface between user and kernel.
  • Kernel – Core of the OS managing memory, CPU, devices.
  • Hardware – Physical components.

Linux Distributions (Distros)

Popular Desktop Linux

  • Ubuntu
  • Linux Mint
  • Arch Linux
  • Fedora
  • Debian
  • OpenSuse

Popular Server Linux

  • Red Hat Enterprise Linux (RHEL)
  • Ubuntu Server
  • CentOS
  • SUSE Enterprise Linux

Most Used in Industry

Two major families:

RPM-based

  • RHEL
  • CentOS
  • Fedora

Debian-based

  • Ubuntu
  • Debian

Difference: RPM vs DEB

Both are package formats used to install software.

Feature RPM DEB
Used in RedHat family Debian family
Package extension .rpm .deb
Package manager RPM/YUM/DNF APT/DPKG

DEB Packages

Example:

google-chrome-stable_current_amd64.deb

Installation:

dpkg -i google-chrome-stable_current_amd64.deb

RPM Packages

Example:

google-chrome-stable-57.0.x86_64.rpm

Installation:

rpm -ivh package.rpm

2. Basic Linux Commands

Open Terminal

The terminal is used to interact with the Linux system.


Show Current Directory

pwd

Displays Present Working Directory.


Create Directory

mkdir directory_name

Example

mkdir linux-practices

Change Directory

cd directory_name

Example

cd linux-practices

List Files and Directories

ls

Create Empty Files

touch filename

Example

touch file1 file2 file3

Absolute Path vs Relative Path

Path

A path is the location of a file or directory.

Example

/home/imran/file.txt

Absolute Path

Complete path starting from root.

Example

/home/imran/linux-practices
/etc/samba.conf
/boot/grub/grub.conf

Always begins with /.


Relative Path

Path relative to current directory.

Example

cd linux-practices

File Operations

Copy File

cp file1 destination

Example

cp file1 /home/imran/

Copy Directory

cp -r directory1 destination

Move Files

mv file1 destination

Delete Files

rm filename

Delete Directory

rm -r directory_name

3. VIM Editor

What is VIM

VIM = Vi Improved

Popular Linux text editor.

Other editors:

  • emacs
  • gedit

VIM Modes

VIM has 3 modes

1️⃣ Command Mode
2️⃣ Insert Mode
3️⃣ Extended Command Mode


Enter Insert Mode

Press:

i

Save and Exit

:wq

Exit Without Saving

:q

VIM Command Mode Shortcuts

Command Function
gg Start of file
G End of file
w Move forward word
b Move backward word
u Undo
Ctrl + r Redo
yy Copy line
nyy Copy n lines
p Paste
dd Delete line
ndd Delete n lines
dw Delete word
x Delete character
/word Search word

Extended Commands

Command Function
:w Save
:q Quit
:wq Save + quit
:w! Force save
😡 Save + quit
:set nu Show line numbers
:set nonu Hide line numbers
:20 Go to line 20

Types of Files in Linux

Linux has multiple file types.

Common ones:

  • Regular file
  • Directory
  • Symbolic link

Symbolic Links

Similar to shortcuts in Windows.

Create symbolic link:

ln -s source destination

Example

ln -s /var/log loglink

4. Grep Command

grep searches text inside files.

Example:

grep root /etc/passwd

Case Insensitive Search

grep -i root /etc/passwd

Show Lines Not Matching

grep -v root file

Filter Commands

less

Shows file page by page.

less file.txt

more

Similar to less.


head

Shows first lines.

head file.txt

tail

Shows last lines.

tail file.txt

cut

Extracts columns from text.


sed

Used for editing text streams.

Example: replace text


I/O Redirection

Used to redirect output.


Redirect Output

command > file

Append Output

command >> file

Redirect Errors

command 2>> errorfile

Redirect All Output

command &>> file

Piping

Send output of one command to another.

command1 | command2

Example

cat file | grep word

Find Command

Used to search files in directories.

Example

find / -name filename

5. Users and Groups

Linux is multi-user system.


Types of Users

Type Example UID Home
Root root 0 /root
Regular imran 1000+ /home/user
Service ftp, ssh 1-999 /var

Important Files

/etc/passwd

Stores user information.


/etc/group

Stores group information.

Format

groupname:password:GID:members

/etc/shadow

Stores encrypted passwords.

Contains:

  • Username
  • Encrypted password
  • Password change info
  • Expiry info

User & Group Commands

Command Description
useradd Create user
adduser Create user (Ubuntu)
passwd Set password
id Show user info
groupadd Create group
usermod -G Add user to group
userdel -r Delete user
groupdel Delete group
who Who is logged in
whoami Current user
last Last logins
lsof -u user Files opened by user

6. File Permissions

Linux permissions control file access.

Three permission groups:

User
Group
Others

Permissions:

Symbol Meaning
r read
w write
x execute

Change Permissions (Symbolic)

Example

chmod ugo+r file

Give read permission to all.


Example

chmod o-wx dir

Remove write and execute for others.


Numeric Permission Method

Permissions values:

Read = 4
Write = 2
Execute = 1

Example

chmod 640 file

Meaning

User = 6 (rw)
Group = 4 (r)
Others = 0

7. Sudo

Allows normal users to execute root commands.


Switch to root

sudo -i

Switch user

su -

Add user to sudoers

Edit sudoers file:

visudo

Disable password for sudo

Add:

NOPASSWD

8. Software Management

Installing software packages.


Download Files

Using wget

wget link

Using curl

curl link
curl link -o file

CentOS / RHEL Package Management

Install RPM

rpm -ivh package.rpm

Upgrade RPM

rpm -Uvh package.rpm

Remove Package

rpm -ev package

List Installed Packages

rpm -qa

Package Information

rpm -qi package

YUM Package Manager

Solves dependency issues.


Install Package

yum install package -y

Example

yum install httpd -y

Remove Package

yum remove package -y

Update Packages

yum update

Search Package

yum search package

Repository List

yum repolist

DNF Package Manager (CentOS 8)

Replacement for YUM.

Commands:

dnf install package
dnf remove package
dnf update
dnf search package
dnf repolist
dnf history
dnf clean all

Ubuntu Package Management (APT)


Update Package List

apt update

Search Package

apt search package

Install Package

apt install package -y

Example

apt install apache2 -y

Remove Package

apt remove package -y

Show Package Info

apt show package

9. Search

Used to locate files or data.

Example

find
grep

10. Login (SSH / Telnet)

Remote login into servers.

Example

ssh user@server-ip

11. File Transfer

Files transferred between systems using tools like:

  • SCP
  • FTP
  • SFTP

12. Disk Usage

Used to check disk storage.

Commands:

df
du

13. Directory Traversal

Navigate directories using commands like:

cd
ls
pwd

14. Services

Services are background programs.

Controlled using systemctl.


Service Commands (CentOS)

Start service

systemctl start httpd

Stop service

systemctl stop httpd

Restart service

systemctl restart httpd

Status

systemctl status httpd

Enable service at boot

systemctl enable httpd

Disable service

systemctl disable httpd

Ubuntu Service Commands

Example for Apache

systemctl start apache2
systemctl stop apache2
systemctl restart apache2
systemctl status apache2
systemctl enable apache2
systemctl disable apache2
systemctl is-active apache2
systemctl is-enabled apache2

15. Compression / Archives

Used to compress files.

Common tools:

tar
gzip
zip

16. Process Related

Used to manage running processes.

Common commands:

ps
top
kill

17. System Commands

Commands for system management.

Examples:

uptime
uname
hostname

18. Hardware

Commands to view hardware information.

Examples:

lscpu
lsblk
lspci

19. Statistics

Commands used for system performance monitoring.

Examples:

vmstat
iostat
free

Final Topics Covered in the PDF

The document teaches:

  1. Linux basics
  2. Linux commands
  3. File operations
  4. Vim editor
  5. Grep and filters
  6. IO redirection
  7. Piping
  8. Users and groups
  9. File permissions
  10. Sudo
  11. Package management (RPM, YUM, DNF, APT)
  12. Services
  13. System utilities
  14. Disk usage
  15. Compression
  16. Process management
  17. Hardware monitoring

Leave a Reply