DevOps Learning

Karthik BalajiKarthik Balaji
7 min read

My First Month Learning DevOps – Here’s What Helped Me"

--->Linux isn't just an OS 👨‍💻 —it's a toolbox 👨‍🔬 . From automating deployments to debugging production issues, Linux commands are part of my daily workflow.

Some of my go-to commands:

sudo su

to move to root user

sudo

temporarily run commands as another user or with elevated privileges

PWD

to know current directory

mkdir

to create directory

ls

to list created directory

touch

to create file

clear

clear the page of the coding

ls -l

to know more details about files and directory

date

to display date and time

rm

to remove directory

cd ..

to go back to the previous directory

cd ../..

to go back two step back from the current directory

cd ~

move directly to home directory

rm -r

To remove the directory with conent

cp

to copy the file from one to another directory

mv

move the file from one to another directory

ls /home/which directory

used to list the file where we want to check the list for the particular directory

history

list all the commands used

vi

to open a file to edit and then press i to edit the file

:

to escape from the file

w

to write the file

q

to quit from the file

cat

used to show the content of the file without opening the file

wc

word count of the file specified

useradd

to add the user

usergroup

to add the group

su

command used to switch user

passwd

to set password for user

/etc/passwd

user list will be shown in this directory

id

will display in which ID we are using

exit

to exit from the current user

userdel

to delete the user

groupdel

to delete the group

usermod -aG

used to add user to the particual group

usermod -dG

used to delete user to the particual group

r(read 4)

read permission for file

w(write 2)

write permission for file

x(execute 1)

excute permission for file

-rw-rw-rw

first rw is user , second rw is group , thisr rw is others

cd filename/

to enter directly to file without home directory

chmod

to change the modification for file permission

chmod u+x g+r ow

to change the modification for file permission by diffrently

chgrp

chmod -r directory name

to change permission for whole directory

/

used to search conent in editor

:%s/needed word/changing word/g

used to replace string

/g

command used to replace string

/gc

will ask confirmation to replaces the string

set number

to show line number in vi editor

set nonumber

will disappear all the number in vi editor

h

move left

j

move down

k

move up

L

move right

|(pipe symbol)

used to club (or) join two commands

/head n( how many lines needed)

shows first how many lines needed

/tail n(how many lines needed)

shows last how many lines needed

/root

home root files located

/temp

temp files will be stored once system rebooted it will be deleted

/var

contains variable files, log files

/home

all user and other home directories are available

/opt

contains software packages

/lib

contains libraries files

nano

one of the editor

jumper server

used to access prod server

SSH username@hostname or ip address

to establish secure connection between server and user

dd

to delete the content in vi editor

sudo vi /etc/hostname

to change hostname of the machine

sudo reboot

to reboot the server

ssh-keygen

to generate ssh key

-a

shows hidden files in

scp

secure copy

scp filename destination@ip 0r host :/path

to move file from one server to another sercurly

:

its the main parameter that helps to connect two servers

tar

to create tar file

-c

to create a file

-v

to show the which file we are going to tar

-f

means files name

-x

to unzip the tar file

/r

remove the files

/f

force the files to remove

zip

used to zip the file

/

used to update the new file or existing files (it is not mandatory) in zipping file

unzip

to unzip the file

sed

to change string in the file

sed 's/name need to change/name changing/' filename

command to change strings in a file

sed 's/name need to change/name changing/1' filename

command to change strings 1st accordance in a file

sed -n 's/name need to change/name changing/1' filename

command to show the changed strings in a file

sed $ (stream editor)

to delete the string in the file

sed $d

to delete the last string in the file

to delete user or group

first we want to delete the dir or folder or file then only we need to dele user or group

-id -g username

to find the id of the user

sudo useradd -m USERNAME

to add user with home directory

sudo useradd -l USERNAME

to add user with home directory with lock

grep editorial /etc/group

locate the group and its user

user -a -G groupname username

to add user to the specific group

tar -cvf backup.tar my_project

to create a tar file

private IPv4

(10.0.0.0, 192.168.0.0 , 172.16.0.0) consider it as private IP

Ports

1) well know ports 2) Register ports 3) Dynamic ports

Well know ports

port from 0 to 1023( used for common server or services) eg: FTP-20, DNS-53 ,HTTPS- 443, SFTP- 21,POP3 - 110, IMAP4- 143,

ifconfig

to show the IP Address of the machine and network cards

ip address

to show IP Address with subnet mask

route -n

to shaow the route table

traceroute

to show the path IP Address is traveling through

curl -I (captital i)

used to check the connectivity of the URL

curl -V

used to check the connectivity of the URL

netstat -tulp (tulnp)

to show the port

ss -tulnp

to show the port with full explanation

nslookup domain name

to check the IP Address of the domain name

host domain name

to show the port with full explanation

telnet or nc -zv

to check the portnumber connection

nmap

to scan the vulnerable scan

arp -a

to show the arithematic resolution protocol table

iptables -L -n -v

to view the firewall rules

winget upgrade

upgrade all the application

fdisk -l

to show the other disk partition (This shows any disk attached to the Instances )

lsblk

to show details report on the disk partition (This dispalys the new volume and it's size)

mkfs.ext4 /dev/xvdf

Format the Newly Created Disk

df -h

To confirm the mount disk

purge

used to uninstall services

apt install xrdp

to install remote connection

systemctl

command used to check the services

systemctl status xrdp

to check the services of rdp

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

to install prerequisties

top & htop

for performance monitoring

awk

for text manipulation

…and of course, a healthy dose of Bash Scripting.

My works on Bash Scripting ----

Script for Server Health checkup :

Script for backup file :

Script for Site connectivity :

0
Subscribe to my newsletter

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

Written by

Karthik Balaji
Karthik Balaji