Linux Learnings for DevOps Engineers

Pooja BhavaniPooja Bhavani
8 min read

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

  1. Ls - list

  2. cd - Change Directory

  3. PWD - Print Working Directory

  4. mkdir - To create a Directory

  5. Delete Directory files

rm - removes file

rm -r - to recursively delete

rmdir - to remove a directory

  1. cat - displays the content of file

  2. echo - to print something

  3. zcat - displays the content of zip

  4. Touch - to create empty Directory

  5. Head - To display top 10 lines

  6. Tail - To display bottom 10 lines

  7. tali -f - displays newly added lines

  8. cp - to copy file to directory or file from one folder to another $ cp devops/devops-file.txt cloud/

  9. mv - to move files from source to destination

  10. WC - word count shows no. of lines, words and bytes

  11. vi editor in Unix and Linux operating system?

  12. hard link - when we create shortcut even if main file gets deleted the shortcut will remain.

  13. soft link - when we create shortcut even if main file gets deleted the shortcut will also be deleted.

  14. cut - if we want a portion it will cut and give us.

  15. tee - to take input or output and display output on the screen as well as in the file.

  16. sort - to sort everything alphabetically.

  17. diff - to see difference between 2 files.

  18. free - shows disk space

    Login related

  19. ssh - secure shell used to login port - 22 used to login to server.

    Disk usage

  20. df - to see disk usage

  21. du - to see what file are stored where

    *process

  22. ps - shows the bash is running on which process

  23. top - shows all the processes

  24. kill - to kill the process

Day 3 (Users & Files Management)

System-level commands

  1. uname - is used to see which platform we are running eg: linux (displays os info)

  2. uptime - to know the uptime of are system

  3. Date - current date

  4. who - shows information about all users that had currently logged into the system. (will get the list of users).

  5. whoami - shows the current logged in username get to know the current user

  6. id - to the id of user, group

  7. Sudo - used in case when we don’t have permission for something

  8. shutdown - to shutdown the system $ sudo shutdown

  9. cat /etc/passwd - to know the list of users

  10. reboot - to restart system

  11. apt - application package manager

User & Group management commands

  1. Sudo - used in case when we don’t have permission for something

  2. useradd - add user in linux cmd $ useradd -m username (-m make a dir)

  3. passwd - to add password to user $ sudo passwd

  4. groupadd: for adding group

  5. gpasswd -a, - to add user to group

  6. gpasswd -m - to add multiple user to group

  7. groupdel - to delete group

file permission commands

  1. Umask - by default the permissions that we want for files that we can give using umask.

  2. Is -l - for long list

  3. chmod - used to change file or dir permissions like read, write, or execute

  4. chown command - to change ownership permissions

  5. chgrp command - to change group permissions

compression command

  1. Zip - to zip multiple files and create a single file

  1. unzip - to unzip the zip file

  1. gunzip - gunzip command is used to compress or expand a file or a list of files in Linux.

  2. 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

    1. SCP command (copy files) - secure copy protocol to securely transfer files from local to remote folder.

    2. rsync command - syncs local folder to remote folder

Day 4 (Networking Commands)

  1. Ping - to know weather the app is running or not

  2. ss/Netstat - display all the active internet connections

  3. ifconfig - displays all the network interfaces.

  4. Tracepath - for path

  5. Traceroute - for ip

  6. Mtr (my trace route) - To run both traceroute and tracepath use :/$ mtr command it pings also gets the path

  7. nslookup - to see if domain is active or not

  8. Telnet - helps to connect to website domain and its port.

  9. Hostname - shows the hostname of server

  10. ip - $ ip address show

  11. iwconfig - shows all wireless connections

  12. arp - to find MAC address

  13. dig - to know all the info related to domain’s ip

  14. whois - is used to know info about website

  15. ifplugstatus - shows the interfaces are running or not.

Types of commands used in networking

  1. ss/Netstat

  2. ping

  3. mtr

  4. tracepath & traceroute

  5. Whois

  6. Arp

  7. Curl- is used to call api endpoints

  8. Jq plugin- gives data in clean format

  9. Wget- to download things

  10. Watch- to check things in loop.

  11. 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.

0
Subscribe to my newsletter

Read articles from Pooja Bhavani directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pooja Bhavani
Pooja Bhavani