Linux-class-all
Linux-class-all
AWS -----SERVICES
-------------------------------6+
DEVOPS ---TOOLS
---------------------
15 COMMANDS --6 YEARS
4 ----SCP
VMWARE MOBAXTERMS PUTTY GITBASH VSCODE vshpre
--------------------------------------SOFTWARE -----------
35
----------
3 12
-------------------
Software downloads:
------------------------
1 task:
--------------
Go to google vmware download
Workstation 17 Pro for Windows
ubuntu iso image download
Ubuntu 22.04.4 LTS 10 days
question
exam
interview
-----------------------------------------
Devops
--------
Dev+ops
-------
dev Team:
------------
plan git maven ---CI
code
build
test
-------------
ops team:
-----------
Deploy Tomcat
monitor prom newrelic
operate
Release
---------------
GIT ---100 SVN BITBUCKET--100 MAVEN ANT TOMCAT JENKINS -500 NEXUS DOCKEER R HUB
SWARM VOLUME KUBERNETES SONARQUBE ANSIBLE BLACKDUCK JENKINS GITHUB GITLAB
TERRAFORM
-----------------------------------------------------------------------------------
-----------------------------------------------------------------
SHELL
PYTHON
BASH
POWERSHELL
GROOVY
PERL
SQL MYSQL ODBC JDBC NOSQL JAVA ---WEB BASED APPLICATION MAVEN
-----------
INTERVIEW
RESUME
NAKURI
PROXY ----MAIN
------------------
AWS--------
EC2 VPC S3 IAM COLUD WATCH COLUD TRAIL RDS ROUTE53 SNS ELK
-----------------------------------------------------------
SUDO APT APT-GET INSTALL MAVEN GIT JENKINS DOCKER SONARQUBE
SUDO YUM INSTALL 14
VM SETUP
6 MONTH JOB SUPPORT
PWFH
----------------
Go to Google;
vmware 17 pro download
ubuntu iso image download
-------------------------------------
1. window
2. Linux
frist one select ---windows
vmware setup open vm
next --i accept ---next next next install
-------------------------------
liency key --setup ubuntu machine
"MC60H-DWHD5-H80U9-6V85M-8280D"
Home:
----
There are 3 Types:
1 create a new vm
2 open a vm
3 connect to a remote server
--------------------------------
First one select:
------------------
1 create a new vm
there are 2 Types:
1 Typical
2 custom
click on first select ---Typical
next
Guset os installation
click on ---I will install the os system later the vm will be created with a blank
hard disk
next
select Guset OS:
there are 4 Types:
1 microsoft window
2 linux -----select
3 vmware ESX
4 Others
------------
Version:
ubuntu ----select
redhat 1to 9
centos
suselinux
fedeora
---------------------
nextName the VM
vm name:
ubuntu-64
location:
C:/usrs/hp/oneDrive/Documents/vm/ubuntu-iso-image-amd64-bit
-----------------------------------------
specify Disk Capacity:
---------------------------
Maximum disk size {gb} ---20.0 Gb
change disk size capacity: 50.0 Gb
next
READY To create VM :
Name:
location
version: worstation 17.x
os:
HD:
memory: 2048 MB
Network adapter: NAT
*****Other Devices: 2cpu core cd/dvd, usb controller printer sound card
finsih
----------------------------------------------------------------------------
MYcomputers:
------------
Ubuntu-64-bit{5}
There are 2 Types:
1 power on the vm
2 edit vm settings
-------------------
select 2 one
edit vm settings
cd/dvd/status Autodetect
There are 2 types:
1 Device status:
connected
connect at power on ---default select
2 computer --conection--------
there 3 Types:
1 use physical drive
2 auto setect
3 use iso image file ---click on
click on Browser
showing the floder
Download
select on File name:
ubuntu-22.04-desktop-amd64-iso
click on ---open ---ok
----------------------------------------------------
after that frist one click on
1 power on the vm
install
welcome
There are 2 Types;
1 try ubuntu
2 install ubuntu
----------------------------
select 2 one click on ---install
keyboard layout
choose your keyboard layout
select english {us}
continue
Updates and other software:
click on install thrid party software for graphical and wifi-hardware and media
format -----click on
Install type or installation types;
click on ---install
now ----
write the changes to disk ---
continue
where are you?
select india map
region name: kolkata
continue
who are you?
your name: ganapathi
your computer name: ganapathi-vm-
pick a user name:ganapathi-vm-
choose a password : abc@123
confirm your password: abc@123
continue
-----------------------------------------------
File Directory system:
-----------------------
following are the directory in the ubuntu os
/ ---------it is called Root Directory it contains all the sub-directory.
--------------------------------------
/home ----1 /home/ganapathi ganapathi user home directory /home/gayatri gayatri
user home directory
/home/divya divya user home directory
----50%
/ ---root admin ---100%
/proc ---it contain RAM process and kernel information application kernel cpu
memory device
/dev
/opt --5 ---very important optional floder installation thrid party software
/usr --6 unix system resources was ihs var db2
/var --7 system log files /var/log , /var/mail /var/tmp
/mnt
/net
/boot
/media
/srv
/root --8
-----------------------------------------------------------------------------------
-----------------
-
cd ---change directory
pwd ---present working directory
/home/ganapathi
ls ---list of files and directory
user {owner) & Group:
ganapathi -----50%
root ---100% prev
sudo su -
adduser hema
sudo ---super key
su ---switch user -
adduser gayatri
adduser sunil
su sunil
cat /etc/passwd
userdel gayatri
su sunil
hostnamectl ----Total system configuration
uptime -----How long the system is active from how many user stroed how long system
is running ....
who ---how many users are connected to this linux
whoami ---username of the current user linux
uname
uname -a
uname -s
cal ---calender
date --Today display date
cal ---install ----ubuntu
sudo apt-get install ncal -y
date "+%Y" ---Current Year
date "+%m" ---current month
date "+%d" ---current date
date "+%d-%m-%Y" ---current day-month-year
date "+%d-%m-%y"
----------------------------------------------
cal 2023 --Display the particcalr year calender
cal 3 2023 ---display the 3rd month calender of 2023 year
cal -3 --Display current month previous month next month
cal -y ---calender of current year
cal -1 display the current month
-------------------------
hostname
cat
touch
date
------------------
hostname <option>
1 hostname ---Display hostname of the computer
Linux server Linux box linux machine server ----usr1 usr2 usr3 To connect to server
2 hostname -a --Display Aliasname of the host, if used if not display one hostname
3 hostname -i ---Display the port number ---but default port number
127.0.1.1 ---default
hostname -I ---if we connected to linux machine then it will give you separated IP
Address.
ifconfig
ipaddress
192.168.150.132 ---every machine changing the ip address
hostname -A ----Display all {FQDN} of the machine
FQDN ---Fully Qulified domain Name
hostname -s ---short hostname
hostname -V --version
hostnamectl ---System total configuration
------------------------------------------------
Very Import:
cat ----file ---color ---white color
There are 3 Functionalites:
------------------------
1 Display content of exiting file
2 create a file & write txt into that file
3 merging two files
------------------------
< ---open the file
> --- create a file
>> ---add the file
cat >ANU ---<file-name> ---create a file along with write access
hi
hru
welcome
"{ctrl +d ----save the files }"
cat < ANU
cat ANU
cat >>ANU ---To append new content into an existing file
WEL TO BANGALORE
ctrl +d ---save the file
cat ANU
----------------
cat >HTML.TXT
<HTML>
<BODY>
<h1> first message </h1>
</body>
</html>
ctrl +d ---save
cat ANU HTML.TXT ---display the content of multiple file together
cat -b <file-name> ---Number nonempty/nonblank lines
1 hi
2 hru
3 welcome
chown: ---To change the file owner ot group whenever u want to ownership u can use
chown command
chown <option> <owner>:<group> </file/directory> ---syntax
chown ganapathi:ganapathi java
-----to change and owner and group of the particular file/dirctory
chown : changing ownership of 'java': operation not permitted. --second issue
sudo chown ganapathi:ganapathi java ---Assume that if u are user name or group name
root and u want to change ownership or group to ganapathi {where your current
directory is ganapathi}
sudo chown ganapathi manohar ---only owner change command
sudo chown :ganapathi manohar ---only group change command
---------------------------------------------------------------------
chmod: --- that to change mode: file or dirctory permission
suppose as owner i created a file dirctory i want to give some permission
to some user on that particular file i can use chmod command
before understanding chmod we need to understanding "Roles & permission first
Roles:
There are 3 Types of Roles:
----------------------------
1 owner/usr ---u
2 groups ----g
3 others ---o
--------------------
permission :
there are 3 Types:
1 read --r
2 write --w
3 execute --x
----------------------
Note:
d --dirctory
c ---character special file
b ---binary special file
- ====file
-------------------------------------
Number method:
r --4
w --2
x --1
Total : 4+2+1 ==7
--------------------------
d /rwx/ r-x/ r-x/
7 5 5
rwx-wx--x
7 3 1
r-xw-x-rw-
5 3 6
------------
666
rw-rw-rw
700
rwx------
543
r-xr---wx
--------------------------------
ugo ---user group others:
ugo=rwx
u=5
g=2
0=7
u+rx,g+w,o+rwx
ugo=rwx
u+5
g-3
0-2
u+rx,g-wx,o-w
-------------------------------------------
chgrp: To change the group ownership of a file or dirctory
all file in linux belong to an owner a group u can owner by using chown command and
the group by chgrp command
syntax
chgrp <option> <group> <file/dirctory>
sudo chgrp root java mano madhavi
----------------------------------------------------
rm
cd
rmdir
more
head
tail
-------------------------------
rm ---romve files or directoryies
rm <option> <file/directoryies>
rm f1 f2 f3 ---remove a multiple file in the same directoryies
rm <file-name> --remove a particular file not in use in pwd rm mano
rm -f file-name ---remove forcefully
rm -f f1 f2 f3 f4
rm -i <file-name> prompt before every removal
rm -i mano.txt
rm: remove regular file 'mano.txt'? yes or no
rm -rf --recursive remove directoryies
rm -R <file/dir>
rm -d <dir-name> ---empty floder remove
rm -v <file/dir> --verbose prompt information
rm -rf --dir-name --remove frocefully all directoryies
real time 2 command only use :
rm file remove
rm -rf dir remove command
-------------------------------------------------------------
cd --whereever you are it take you to be Home directoray eg: /home/ganapathi
/root /home/sunny /home/jyothi
cd ----change directory
cd / --Root directory
cd ~ ---Home directory eg:root /home/linux, /home/ganapathi till directory
cd .. ---one level directory back or parent directory
cd ../../ ---Two level back directory
cd ../../../ ---Three level back directory
cd . ----current directory
cd - ====previous path directory
if you change your pwd manohar floder to hari then you want to go back to the
previous directory
cd <Absolute-path> --it takes you to the absolute path you have given
eg: /root/manohar/arjun/rama
cd manohar
cp -r ../../homeganapathi/Download/jdk-17.tar.gz . ----absolute path
cd <Relative path> ---it takes you to the relative path you given
eg: now i am in manohar floder if i give command like cd Arjun ---takes me to arjun
floder
cp -r ../../homeganapathi/Download/jdk-17.tar.gz /home/ganapathi/manohar --relative
path
-----------------------------------------------------------------------------------
------------
rmdir: Remove directories
rmdir <option> <dir-name>
rmdir manohar
rmdir /home/ganapathi/manohar/raja/vijay
note: we can't remove the pwd by using rmdir command
-----------------------------------------------------------------------------------
----------------------
head ---To disply frist 10 lines of a file {default}
head mano.txt ---to display only first 10 lines --default
head -15 <filename> ---display first 15 lines without "n" flag
head -15 manohar.txt
tail ---To display the last 10 lines of a file
tail <file-name> ---To display the last 10 lines default
tail -n 20 <file-name> ---to display the last 20 lines
tail -20 manu.txt
--------------------------------------------------------
note: ls -lart |head -----10 lines from the list
ls -lart |head -3 ---frist 3 lines
ls -lart |tail ---last 10 lines display
ls -lart |tail -5 ---last 5 lines only
--------------------------------------------------
tar ---Zipping & Extracting files
zip
gzip
-----------------------------
c --create a new.tar archive files
v --verbosely show the .tar files progress
f --file name types of the archive files
x --extract the archive
t --displays or lists files in archive files
u --archive and adds an existing archive files
v --display verbose information
A --concatenates the archive file
z --zip tells tar command that create tar files using gzip
j ---filter archive tar files using tbzip
w --verify an archive file
r --update or add file or directory in already existing .tar file
tar -cvzf jdk-17-linux-tar.gz ---name to the zipped directory to be zipped
unzipping | extracting
tar -xvf jdk-17-linux-tar.gz
note: if we dont mention target directory if extract in current directory only
-----------------------------------------------------------------------------------
-------------
cd /opt
sudo mkdir java
ls -lart
root:root
sudo chown ganapathi:ganapathi java
ls -lart
ganapathi:ganapathi
cd java
ls
go to google java 17 download .tar.gz
Download: jdk-17-linux-x64_bin.tar.gz
pwd
/home/ganapathi/Download
jdk-17-linux-x64_bin.tar.gz
/opt/java
cp -r ../../home/ganapathi/Download/jdk-17-linux-x64_bin.tar.gz .
cp -r ../../home/ganapathi/Download/jdk-17-linux-x64_bin.tar.gz /opt/java
cd /opt/java
jdk-17-linux-x64_bin.tar.gz ----red color ----no permission ---bug issue
chmod 755 jdk-17-linux-x64_bin.tar.gz
tar -xvf jdk-17-linux-x64_bin.tar.gz
--------------------------------------
ubuntu
sudo apt-get install java -y
redhat
sudo yum install java -y
--------------------------------------
cd jdk-17.0.9
ls -lart
/bin
pwd
/opt/java/jdk-17.0.10 ----copy
echo $JAVA_HOME ---env set or not path
env
----------------------------
Environment variable file setup
/opt/java/jdk-17.0.10
cd
vi .bashrc
sudo apt-get install vim -y
-------------------------
vi .bashrc ---perment env setup
vi /etc/profile
------------------- very very import
i ---insert mode
export JAVA_HOME=/opt/java/jdk-17.0.10
export PATH=$PATH:$JAVA_HOME/bin
esc
shift:
wq! --save & quit
java -version
source .bashrc --------very import
java -version
----------------------------------------------------------------
du
df
free
top
htop
---------------------------------
du ---Disk ultization estimate file space usages
du <option> <fie-name>
4000 /home/ganapathi/manohar.txt
8200 /root/ganesh.txt
du -h/H --Human readble format size file path
4m
5k
4GB
----The total disk ultization can be shown in human readble format
like 20k 50m 60G
du -sh --h --human readble format
--s --summary
du -sh <dir-name> ---particular directory disk ultization
du -a --all files and floders
du --inodes ---list inode usages information instead of block usages
du -k ---block size ==1k
du -m --block size ==2m
du --time ---with times
-----------------------------------------------------
df ---"Disk free" Report file system disk space usages
df <option> <file>
df
filesystem 1k-block size used Avaiable use% mounted on
/dev/sda1 12345 1234 1234 1234545 71% /dev/sda1
df -h/H ---Human readble format
filesystem 1k-block size used Avaiable use% mounted on
/dev/sda1 18g 12G 6g 13g 76% /dev
free -b --Bytes
free -k --kilobyte
free -m --megabyte
free -g --giga byte
free -h ---human readble --gigabyte by deafult
free -w --wide; buffer & cache separated
free -l --show detailed low-high memory statistics
free -t --total rows will be displayed
----------------------------------------------------
top & htop -- Display Linux process
cpu, memory related {%}
it provide dynamic real time view of your running system
to see which process consuming most of cpu & memory
just like "Task Manger" in windows
top
pid user pr ni virt res shir s %cpu%mem time command
note " to quit from the windows server we need to press
quit
ctrl +c ---kill
ctrl +z ---save
-------------------------------------------------------------
useradd
adduser
groupadd
groupdel
userdel
usermod
passwd
gpasswd
------------------------------------------------------------------
useradd
adduser
groupadd
groupdel
userdel
usermod
passwd
gpasswd
-----------------------------------------------
useradd ---To create a new user or updated default new user information
useradd <username>
useradd manu ********************
useradd -m sagar --to create a Home directory for a new user
useradd -s /bin/sh hema --default shell creation default login shell specified by
the shell variable like /bin/bash
useradd -b /bin/bash hari ----the default "based directory"
/etc/default/useradd
/home
useradd -c --"comment"
useradd -e yyyy/mm/dd <user-name> ---"Expire date to create an user with expire
date. ***
-----------------------------------------------------------------------------------
--------
How to check user command:
cat /etc/passwd
----------------------------
adduser sagar ----To create a Home directory ----50 % access -----------"very very
import in real time cmd"
-----------------------------------------------------------------------------------
----------------------
userdel ---Delete a user account and related files
userdel <user-name>
sudo userdel -r <user-name> --To delete user and it's directory
sudo rm -r <user-directory> ---To remove user directory after running /deletting a
user
sudo rm -r /home/ganapathi/manohar
userdel -f <user-name> --removing user forcefully
----------------------------------------------------
groups: To see what are the groups your current user connected to print the group a
user is in group
note: cat /etc/group
it display total number of users to location of groups
groupadd <group-name> -- to add a new group
groupdel <group-name> ---To delete a particular group
usermod -a -G groupname username
passwd <user-name> ---To create a passwd add in user
gpasswd <user-name> ---To create a gpasswd add in group user
-----------------------------------------------------------------------------------
----------------------
manohar ------dev
sunny -----Build & Relase ----Dev
gayatri
vinod
swathi
siri
------------------
QA
----naresh
mano
naven
manoj
----------------------
sudo apt-get update -y
sudo apt-get install openssh-client
sudo apt-get install openssh-server ii
sudo service ssh status
Active: Running status
----------------------------------
ssh locahost
welcome to ubuntu 22.04.5 LTS {GNU/Linux/*****generic x86_64}
ssh-keygen
---------------generating public and private key pair id_rsa id_rsa.pub known_host
pwd
ls
.ssh
ls -a
cd .ssh
ls
id_rsa ---beging openssh private key
id_rsa.pub ---public key
-------------------------------------------
server to server connection:
ssh username@ipaddress {hostname -I}
eg: ssh [email protected]
ganapathi password: abc@123
ssh [email protected]
linux password: abc@123
--------------------------------------------------
scp ---secure copy file one server to another server & source server and
destination server
scp <option> source path & destination path
i ---inode
r --reverse order
v --verbose
h --human-readble format
p --parameter
a --hidden files
l --long list
s --size
source id :192.168.150.131
destination id: 192.168.150.132
scp -r jdk-17-linux-bin-tar.gz {source-path} [email protected] {destination
serverid} :/home/linux/manohar
scp -r jdk-17-linux-bin-tar.gz [email protected]:/home/linux/manohar
-----------------------------------------------------------------------------------
----------------------------
more
wc
echo
diff
comm
------------------------------
more --to display the content page by page it display only the content
which files inthe terminal window
more <file-name> display first page
more -s mano.txt ----seueze multiple blank line into file
more -u mano.txt --supress underling -p -c dont scroll
----almost everything is same we cant navigate to previous page with in more but it
can possible
with less command
less <file-name>
ls -lart |more ---list with more command
----large list
ls -lart |less ---list with less command ---large list
----------------------------------------------------------
wc ---word count
----count new lines , word, byte/charcters
wc <file-name>
eg:20 ---lines
20 --words
20 --charcters
wc file1 file2
----count from multiple files
wc -l <file-name> ---only lines count
wc -w <file-name> ---only word count
wc -c <file-name> --only charcters counts
wc -c <file-name> --only byte counts
both are same
Combinations:
----------------
wc -lw <file-name>
wc -lc <file-name>
wc -wc <file-name>
--------------------multiple file together
wc -L <file-name> max-line-length; print the maximum display width
eg: wc -L mano.txt
wc -l mano.txt
---------------------------------------------------------------------------
echo
-----------
display a line of line of text; string that are environment. bashrc files an
arguments this is build in command that is mostly used in shell script and batch
files
to output status text to the screen or file.
syntax:
echo <option> <string>
echo Hello World
printing text |string
eg:
echo $variable-name----------printing a variable name
eg: myvar="hello world"
-------only for single session of terminal
echo $myvar
hello world
eg:2
x=10
echo "The value of x is $x"
The value of x is 10
option:
-------
echo -e ---enable the interpretation of backslash escapes
echo -e "\b"
it removes all the spaces in b/w the text
eg: echo -e "manohar\bfrom\bnellore"
echo -e "\c"
supress trailing new lines with backspace interpretor "-e" continue without
emitting new lines
eg: echo -e "manohar \cfor manu"
manohar
text after \c not printed and emitted training new lines
echo -e "\n"
creates new lines
eg: echo -e "kalyani \nfrom \n tirupathi
kalyani
from
tirupathi
-------------------
echo -e "\t"
-----------
Tab ---
eg: echo -e kalyani \tfrom \tbangalore
kalyani from banalore
echo -e "\r"
----------------
carriage return
echo -e manohar \rfrom TPT"
from TPT
text before /r not printed
************echo *
----------------------
print all files/floder; simalar to ls command
echo *
-------------------
echo -e -n "text"
this option is used to omit echaing trailing new lines
eg: echo -n "manohar from tirupati"
manohar from tirupati
-----------------------------------------------------------------
diff:
----compare file line by line give mismatch
diff <option> <file/directory>
< ---frist file *****
> ---second file ****
c ---change
d ---delete
a ---add
---------------------
eg: diff.txt
hi
hru
welcome
eg:2 diff2.txt
hi
hello
hru
comm:
--------
----compare two sorted files line by line
comm <option> file file2
pre-requisite: sorted file only otherwise
we need to sort them before apply commn
note: it provides file o/p in columns 1st column display unique lines of 1st files
-----------------------------------------------------------------------------------
-------
nslookup
grep
find
ps
kill
firefox
firefox &
netstat
ping
-------------------------------------------------------------
git
------bare-remote
10 ----task
------
---------------------
nslookup:
-----------
Name server lookup getting into from the DNS server --53
dns three server primary server, secondary servers, and caching servers.
it is a network administration tools for querying the domain name system {DNS} to
obtain
domain name or ip address mapping or any other speific dns-record it is also used
to
troubleshoot DNS-related problem
vpn {virtual private network}
click on "start", then "setting", network & internet", "wi-fi". selet the network
you're connectted to . click on "properties." Scroll down to the bottom
of the window your IP will be shown next to "IPV4 address.
tcp or udp ---transmission control protocol
user datagram protocol
A, AAAA, CNAME, PTR, NS, MX, SOA and TXT
syntax:n
nslookup {option}
nslookup -type= google.com
------------------------
lookup for any record; we can also view all the aviable DNS records using the
-type="any" option
2. nslookup <IPAddress>
to findout domain name
nslookup -type= nsgoogle.com
-----------------
lookup for an ns {name server} record
ns record maps a domain name to a list of dns servers authoritative for that
domain it will output the name server which are associated with the given domain
Note:
no commands
uid ---user id
pid --process id
ppid ---parent process id
c ---cpu ultization
stime ---starting time
tty ---type of terminal
cmd ---command
---------------------------------------
ps -e ---Display all process /internal process which are also running by the linux
or unix vm
eg: pid tty time cmd
ps -ef ---Full information of all rinning process by the user as well as linux
machine
ps -H --tree structure like;
if we execute multiple shell script files with in this we have multiple tree
structure like command this command shows hierarchical way of representation
ps <pid> --to display particular process information
examples: to see every process on the system using standard syntax
ps -e
ps -ef
ps -eaf
ps -e/f
to print a process tree
ps -ejh
to get info about threads
ps -elf to get security info
ps -eo ---user, ruser, fuser, f, comm, local
ps -em
to see every process running as root real & effective id in user format
ps -U root -u root u
ps -aux
to see every process running with a user-defined format
ps -l -c to show different sehedular information {long format}
ps -ux --to print long list of process
ps -U <user-name> --process with particlar user-name
ps -C <user-name> to print multiple instance of user name
-----------------------------------------------------------------------------------
-------
kill ---To kill the process
kill <option> <pid>
kill <pid> ---to kill particlar process with its id
eg: kill 793
kill <pid>, <pid> --to kill multiple process with thier ids
kill 765,664,735
kill -L/l ---list the Available signal choices in a nice table
kill -9 <pid> ----to forcefully kill multiple process with thier ids
kill -9 567,678,988
kill -3 <pid> --gracefully killing firefox
firefox --fg
firefox & --bg
-----------------------------------------------------------------------------------
-