Linux Learnings for DevOps Engineers

Day 1
How does the internet reach us?
→ The internet reaches our homes through optical fiber cables, which connect data centers.
What is server?
→ Serves the information to client
Difference between server and client?
→ Server serves the information and client requests for information from server.
Difference between the web server and the application server?
→ A web server like Nginx serves static content, while an application server like a Node.js application handles dynamic content.
What are standalone apps?
→ It doesn’t require internet like doesn’t require database, email, cache, file system.
What are web applications?
→ It requires internet like require database, email, cache, file system, cloud supports the web app.
Introduction to Linux
What is Linux?->Introduction to Linux Operating System(OS)
→ Is an operating system where the applications run, we can create folders, write code etc.
How to Install Linux?
-WSL (Windows sub-system for Linux)
-Virtual box
-AWS, Azure, GCP any cloud virtual machine
-vagrant
Difference between Linux and Windows?
→ Windows is a commercial License we need to pay to use windows os
Linux is general public license we don’t need to pay for os.
Software remote location server tools?
-RDP (Remote Destop Protocol)
-SSH (Secure Shell)
What are the kernel, Bootloader, and shell?
→ Kernel includes coding files, proccesses required to run os, Shell is a terminal using which we can talk to kernel, Bootloader is a process that runs files to start os. type od bootloder GRUB (GRand Unified bootloader) is the program on Linux systems that loads and manages the boot process.
Linux System Architecture?
Information about hardware?
→ Run some commends to get information about hardware (like dick, RAM, CPU)
top
df -h
free -h
Linux file system?
→ The Linux file system is a structured way of storing and organizing files on a storage device. Linux uses a tree-like structure with the root directory (/) at the top.
States of Processes in Linux?
Sleeping
running
terminated
Linux Commands
Day 2
Ls - list
cd - Change Directory
PWD - Print Working Directory
mkdir - To create a Directory
Delete Directory files
rm - removes file
rm -r - to recursively delete
rmdir - to remove a directory
cat - displays the content of file
echo - to print something
zcat - displays the content of zip
Touch - to create empty Directory
Head - To display top 10 lines
Tail - To display bottom 10 lines
tali -f - displays newly added lines
cp - to copy file to directory or file from one folder to another $ cp devops/devops-file.txt cloud/
mv - to move files from source to destination
WC - word count shows no. of lines, words and bytes
vi editor in Unix and Linux operating system?
hard link - when we create shortcut even if main file gets deleted the shortcut will remain.
soft link - when we create shortcut even if main file gets deleted the shortcut will also be deleted.
cut - if we want a portion it will cut and give us.
tee - to take input or output and display output on the screen as well as in the file.
sort - to sort everything alphabetically.
diff - to see difference between 2 files.
free - shows disk space
Login related
ssh - secure shell used to login port - 22 used to login to server.
Disk usage
df - to see disk usage
du - to see what file are stored where
*process
ps - shows the bash is running on which process
top - shows all the processes
kill - to kill the process
Day 3 (Users & Files Management)
System-level commands
uname - is used to see which platform we are running eg: linux (displays os info)
uptime - to know the uptime of are system
Date - current date
who - shows information about all users that had currently logged into the system. (will get the list of users).
whoami - shows the current logged in username get to know the current user
id - to the id of user, group
Sudo - used in case when we don’t have permission for something
shutdown - to shutdown the system $ sudo shutdown
cat /etc/passwd - to know the list of users
reboot - to restart system
apt - application package manager
User & Group management commands
Sudo - used in case when we don’t have permission for something
useradd - add user in linux cmd $ useradd -m username (-m make a dir)
passwd - to add password to user $ sudo passwd
groupadd: for adding group
gpasswd -a, - to add user to group
gpasswd -m - to add multiple user to group
groupdel - to delete group
file permission commands
Umask - by default the permissions that we want for files that we can give using umask.
Is -l - for long list
chmod - used to change file or dir permissions like read, write, or execute
chown command - to change ownership permissions
chgrp command - to change group permissions
compression command
- Zip - to zip multiple files and create a single file
- unzip - to unzip the zip file
gunzip - gunzip command is used to compress or expand a file or a list of files in Linux.
tar - is also used to compress files $ tar -cvzf : c - creates an archive by bundling files and dir together. v - verbose (providing detailed info) z - Uses gip compression files - Specifies the filename of the archive to be created
untar command
• file transfer command
SCP command (copy files) - secure copy protocol to securely transfer files from local to remote folder.
rsync command - syncs local folder to remote folder
Day 4 (Networking Commands)
Ping - to know weather the app is running or not
ss/Netstat - display all the active internet connections
ifconfig - displays all the network interfaces.
Tracepath - for path
Traceroute - for ip
Mtr (my trace route) - To run both traceroute and tracepath use :/$ mtr command it pings also gets the path
nslookup - to see if domain is active or not
Telnet - helps to connect to website domain and its port.
Hostname - shows the hostname of server
ip - $ ip address show
iwconfig - shows all wireless connections
arp - to find MAC address
dig - to know all the info related to domain’s ip
whois - is used to know info about website
ifplugstatus - shows the interfaces are running or not.
Types of commands used in networking
ss/Netstat
ping
mtr
tracepath & traceroute
Whois
Arp
Curl- is used to call api endpoints
Jq plugin- gives data in clean format
Wget- to download things
Watch- to check things in loop.
Awk- to extract lines from logs eg: from 2000 lines we need to extract line no.5 or 2,80 then use awk.
Day 5
Difference between/w awk and SED
awk - we require formatted data or csv (comma separated values)notm
SED (Stream editor) - if data is not formatted/unstructured we can use SED
difference is syntactial and awk works on records which is structured and SED works line by line which can be unstructured
GREP (Global Regular Expression Pattern)- to find lines by string/word.
# Volumes
lsblk (list the blocks)- shows which volumes are attached
# Mount means to bind volume to a location
pvcreate to create physical volumes
vgcreate - to create volume group
lvdisplay- displays info about logical volume
vgdisplay- displays info about volume group
# difference between/w mount and attach
Attach means to add a block to disk
Mount means to make that block usable
Introduction to Linux Volumes and AWS EBS
→ In linux volume refers to a storage space that is managed by the operating system
In EBS allows us to store data in blocks used the EBS service is used with Amazon EC2 instances.
- Physical vs Logical Volumes vs Volume Groups in Linux
→ logical volumes are partitions of which we can reduce or increase the sizes according to requirements.
Physical volume - is the actual physical disk or partition that LV uses.
Volume Groups - we can combine multiple PV’s volumes and create a group. (eg: volume1: 10GB, volume2: 12 GB, volume3: 14 GB we can combine this and create a group)
- Mounting Volumes in Linux?
→ Mounting is the process of making a storage device (like a disk or partition) accessible to the Linux system by attaching it to a directory in the file system.
- Managing AWS EBS on EC2 Instances?
→ Attach an EBS volume to an EC2 instance (through AWS Console or CLI). Resize EBS volumes dynamically using AWS Console.
- Introduction to LVM (Logical Volume Manager)
→ LVM provides flexibility in managing disk storage. Combine multiple disks, Resize volumes easily.
- Using LVM with EBS for Dynamic Storage Management (Notes)
→ combine multiple EBS volumes into one pool, Extend logical volumes when the app needs more space.
Subscribe to my newsletter
Read articles from Pooja Bhavani directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
