š addicted on Linux **
š± I’m currently learning Devops , Hacking
šÆ I’m looking to collaborate on open Source projects
š I regularly write articles on https://twinsaitechie.blogspot.com/
š« How to reach me krishnansai71@gmail.com
Github profile
https://github.com/krishnansai
Youtuber Twin Sai Tech
Monday, September 5, 2022
docker commands
con = container
Docker run con name ---- run the container
docker create con name --- create a con
docker start -a con name ---- to start a
docker system prune ---- to show the stop, build
docker ps --- current running container
docker ps -a --- all docker container
docker stop con name --- stop the container
docker kill con name --- kill the container
docker rm con name --- remove the container
docker images -- display all images
docker rmi con name ---remove the docker images
docker pull image name --- pull the docker image
docker exec con name --- execute the docker container
docker run con name --name (defult) --- to mentain
docker run -d con name --- run the con
docker attach name --- attach the docker id uniq
docker run -d con name sleep (sec) --- to
docker version --- to identify the version of the
docker run -p 8080:3456 con name -- port mapping
docker inspect con name --- display the details in
docker logs con name --- display the logs of
docker run img name: version --- to run the
docker build. --- build the docker images
docker build. -t image name --- build and mention
docker history con name ---- to see the history
cat /root/{app-name}/Dockerfile --- to see the image of the
docker run redis --- to run the server
docker exec -it con id redis-cli ---- to run
docker exec -it con name sh, bash, Powershell, zsh
docker commit -c 'CMD ["comment"]' con id ---- to
docker run -t -d -v /home/Krrish/Desktop/sampledir/:/var/www/html --name good day
WORKDIR /usr/app --- work dir app
docker-compose up -d ---- to start a multiple containers
docker-compose down ---- to stop a multiple containers
docker-compose up --build ---- to rebuild the container
restart type = no, always, on-failure, unless-stoped
docker build -f Dockerfile.dev . --- to build any
docker run -p 3000:3000 -v $(pwd):/app con name ----
docker run -p 3000:3000 -v /app/node_modeules -v $(pwd):/app con
network{
default bridge ---- default 172.17.0.1
custom bridge ---- 172.18.0.1 isolated
host ----- connect with host ip without define ports
macvlan ---- it also asign like a vm and
ipvlan --- connect with host and the macvlan
}
Shell Scripting
cat /etc/shells ---- to display total shells in our
sleep (sec) ----- to sleep and run
$? --- when code is succesfull it return 0
$1 ---- to get a input in same line
echo ${#variable} ---- to display the string count
set -x ---- to print with an command
set -n ---- to debug the code while running
set -e ---- to stop the while code in
grep{
grep -v "#" ---- to grep the details except
grep -i string ---- to remove the case sencitive
grep -w ---- match exact word
grep -v --- to print execpt that line
grep -o --- to print exact word only
grep -n --- to match the line number
grep -c ---- to match the line count
grep -A "string" 1 --- the string is match
grep -B "string" 2 --- the string is match
grep -C 1 "string" --- before and after print
grep -r "string" * --- to search n a
grep -l "string" --- to print only file names
grep -h "sting" --- to hide the file name
grep -f file filename --- to search from a
grep -E "string|srting|string" --- check with a multiple string
grep "^string" --- to print the starting line with
grep "string$" ---- to printthe match word with the
grep "^$" filename --- to match with an empty
grep "\^" --- print the exact word on it
grep "t...e" --- to match with first and last
grep "\bline\b" --- to print the word and end
grep "yf?" --- the f in the string is
grep "yf*" ---- have f or mor time
grep "[yft]" ---- split with an multiple char
grep "yf+" --- the f in the string is
grep "[a-f]" --- to search with a char to
grep "[a-dp-r]" --- to print with a secquance word
grep "^[xy]" --- to print the line it starting
grep "x{4}" --- check with 4 times
grep "gf{3,4}\b" --- 3 , 4 time only
grep "[[:digit:]] filename --- to print the number where
grep "[[:upper:]] filename --- to print the upper case
grep "[[:lower:]] filename --- to print the lower case
}
jq{
cat filename | jq '.' --- display in a
cat filename | jq -c '.[]' --- display output
}
cut{
cut -f 2 filename ---- to seprate with the
cut -d ':' -f 2,4 filename ---- to filter
cut -d ':' -1,4 filename --output-delimiter=" " ---- to
cut -sf 1 filename ---- to execute with wich
}
awk{
awk ' /version/ { print $4 } ---- to
awk ' NR==1 { print $4 } ---- to
awk -F '[ /]' '/version { print $4 }
awk 'BEGIN { OFS="_" } { print $1,$3 }
awk ' { print NR,$4 } ---- to print
awk ' { print NR,$4,NF } ---- to print
awk ' { print $NF } ---- to print
awk '{ print substr( $1, 3, 1 ) }'
}
tr{
tr '[:upper:]' '[:lower:]' < filename ---- convert upper to
tr 'i' 'I' < filename ---- change the letter
tr -d ',' ---- to delete a command
tr -d '[()]' ---- to delete a multiple command
}
sed {
sed ' ' filename ---- to work like a
sed -n '3p' filename ------- to print exact line
sed -n '3,10p' filename ---- to print in a
sed -n '3,+7p' filename ---- to print a count
sed -n '3~7p' filename ---- to print 3,7,10,13 count
sed '4d' filename ----- to delete 4 line doesn't
sed -i '4,6d' filename ---- to remove the value
}
if [ $num1 -gt $num2 -o $num3 -lt $num4
if [[ $num1 -gt $num2 || $num3 -lt $num4
if (( $num1 > $num2 )) --- use simples
$(whoami) ----- to use the defalt command method
echo $SHELL --- to display the current shell is
ps $$ --- to display the current shell is
ctrl + u ---- to erase the complete line
ctrl + w --- to remove the particular word
type -a (command name) --- to identify the command
#!/bin/bash --- to mention the execute path
chmod +x filename ---- to change the permission of
./filename ---- to execute the file from the terminal
#!/usr/bin/env bash --- to create a env on our
# ---- single line command
<<(mention any word ending with the same name) -----
example
<
dogged
SAMPLE ---- to end it
variables two type
-system
upper case
env
- user-defined
lowercase
var="sai"
echo $var --- to print the output
don't use space to declare the variable
case sensitive
${var}var ---- use { } to decular the variable
echo "hello world $(whoami)" --- to execute the shell
echo 'hello world $HOME' --- doesn't execute the script
\ --- to work like a single qoutes
ls \ && pwd --- to use a multi
unset SAMPLE --- to un set delete variable
read -p "ENTER USER NAME:" (variable) --- to input
(-p) -- prompt
(-t) --- time out input
(-s) --- password input doesn't input
echo $variable ---- to print the user name
echo $(( 1+1 )) --- to use operation +,-
declare -i int=100 ---- to decule a integer data
readony variable ----- used to doesn't change the value
${newvariable?errormessage} ---- to identiye a decular variable
alias --- to set our own command
PS1="TERMINAL" ---- to change our own terminal command
PS1="\u@defined name" ---- to custom our terminal
echo $? --- to check the previes command state
test 10 -gt 5 && echo "10 is greater"
[ 10 -gt 15 ] ---- same like a
((10<15)) --- same like that
if and elif condition
if [ 10 -gt 5 ]
then
echo "10 is greater"
elif [ 10 -gt 20 ]
then
echo "equal"
else
echo "not"
fi
number comparisons
gt --- gather than <
lt---- less than >
ge --- greater or equal to <=
le --- less than or equal to >=
eq ---- equal to =
ne ---- not equal to !=
-a --- and &
-o --- or |
array
x=(1 3 5 "sai")
echo "${x[*]}" ---- print all number
string comparisons
=
!=
-z ---- not null value check
file comparisons
-b
-c
-d ---- to check a directory
-f ---- to check a regular file
cli position
echo $0 --- correct script variable
echo $IFS ---- tab char
cat -stv <<< $IFS --- to display non printable
case statements switch case
case $var in
"sai") echo "in side " ;;
"nmap") "scan tool" ;;
*) echo "no value" ll
esac
loops
for
in
(())
for x in 1 2 3 4 5 6
do
echo $x
done
for (( i=1; i < 10 ; i++ ))
do
for(( j=1 ; j < 10 ; j++ ))
do
echo ${i}${j} || printf "\n"
done
done
-----------
while
while [ expression ]
do
....
done
while :
do
.....
done ----- infinity loop syntex
-------------
--function--
function sai(){
echo good boy;
}
sai;
sai;
------------
my=0
while :
do
read -p "value : " my
if [[ $my -eq 0 ]]
then
echo "running"
else
-----
while get input from another file
while IFS="," read f1 f2 f3 f4
do
echo "$f2"
done < filename
----
input two value and print it
read x;
read y;
echo $((x+y));
echo $((x-y));
echo $((x*y));
echo $((x/y));
Sunday, May 8, 2022
Linux-Bash commands
cd -- change dir
ls -- list
command -- --- stdin
command -- --- stdout
command -- --- stderr
PWD -- present working dir
ln -- hard and soft link
rm -- remove
mv -- move,rename
cp -- copy
more -- to see file in screen size
more -- --- to see first two numbers
more -- --- to see after 4 numbers
chmod -- change the read-write execute permission
grep -- seprate the same value
whoami -- what user
whatis -- to known the command discription
man -- to know how to use the
wget -- create an HTTP link and download
exit -- exit from the terminal
zip -- file ---- zip the file
unzip -- --- unzip the file
ifconfig -- ipaddressoo
nano -- open the text editor
touch -- create a normal file
cat -- read the text file
mkdir -- create directory
ping -- check IP live or dead
sudo -- --- root user
ps -- a run process
top -- running task
head -- ---- to display first 5 number
tail -- --- to print last 4 line
sed -- '6,12p' filename --- to print condition
locate -- locate the path
nslookup -- domain IP address
whois -- domain name
file -- file type
mkdir -- make dir
rmdir -- remove dir
\ -- create a file with space
Alt+F -- move between words
Alt+B -- move back between words
ctrl+c -- copy
ctrl+v -- paste
ctrl+L -- clear
Alt+u -- change capital
Alt+l -- change lower
ctrl+k -- cut letter
ctrl+y -- paste the words
ctrl+r -- to suggest the recent values
cal -- calendar
date -- current date
poweroff -- shutdown
reboot -- system reboot
vi -- text edit
gedit -- grapical text editer
history -- history commands
less -- same as cat
tac -- same as a cat
head -- to display the top 10 line
tail -- to display the bottom 10 line
WC -- line num, word num, byte num
type -- command type
which -- to mention the part of the
help -- to help the command process
man -- it is used to listing the
• -- everything
alias -- to create a new command alias
hostname -- IP address
netstat -- network connection, routing tables
traceroute -- routes and hops used by packet
time -- --- user and system time used
& -- to do more than one operation
; -- one operation completes then the other
echo -- --- status of last executed command
&& -- if the first operation success the
// -- if the first operation fails also
| -- op of one command is passed
> -- to pass op of one to
sudo -- --- display current run level(0-6)
mount -- to attach external filesystem to filesystem
umount -- detaches the external file system from
awk -- scripting language for file modification and
ping -- name) ---- ping and find the
nc -- address port num ---- to get
[GET -- HTTP/1.1] --- to enroll the data
[HEAD -- --- to enroll the head data
[OPTIONS -- HTTP/1.1] ---- to see the options
dig -- name ---- to identify the IP
sudo -- -m (name) --- to add a
sudo -- (name) ---- to set the password
sudo -- (name) --- to create a group
sudo -- -a -G (group-name) (user-name) ----- to
getfacl -- --- to display the all deatils
sudo -- ---- to display the network speed
sudo -- - username --- to change the
sudo -- allow/status/enable (port-nun)
sudo -- -tupln ---- to see the active
"$(date --
chsh -- to change the shell
vi -- number --- to display number in
cat -- filename --- to display the number
dir{ --
/ -- root dir
/home -- to split the different user home
/var -- to store the log fille
/etc -- to store the configu file
/temp -- to store the temp files
/opt -- storing thrid pary app
/lib -- store library file
/root -- admin/high privilages
/bin -- binary files
/dev -- show extral device
} --
Tuesday, January 11, 2022
Bash script to automate and detect and scan your local networks
Thursday, January 6, 2022
How To Disable Unwanted ports in linux using Terminal
Monday, September 27, 2021
Terrorist Tracker Toolkit
This tool is made for MANTHAN Compadition This tool is used for find the attacker in instagram in 4 module in single tool
Module 1)find the attacker using web Scraping
Module 2)find the attacker information
Module 3)find the attacker Location
Module 4)find the image details
Tool working video
https://drive.google.com/folderview?id=1PsAzYRFJ1G4w7PW473bMJoC1lPYRjXuF
Zip file link
https://drive.google.com/drive/folders/1o4k91CCHBlXx3LiVcEpv4Adj1DeB5tV4?usp=sharing
if anyone want the zipfile password please message to krishnansai71@gmail.com
Step 1 : download the tool from the zip file
Step 2 : Extract our tool in seperate folder. Anyone want tool password my to my mail
Step 3 : Type : pip3 install -r requirements.txt -> To install all requirements for using our tool.
Step 4 : Minimum Requirements : Mozilla Firefox Browser.
Step 5 : To run our Tool, Type This command : python3 main.py
Terrorist Tracker Toolkit :
Friday, September 17, 2021
Docker tor automation
Argocd with rollouts examples
examples in My github https://github.com/krishnansai/argocd-rollouts.git ArogoCd with ArgoRollouts Rollouts.yml # This example demonst...
-
This tool is help us to create a server and port forwarding it and tansfer the file to one system to another system easyly with out any soft...
-
examples in My github https://github.com/krishnansai/argocd-rollouts.git ArogoCd with ArgoRollouts Rollouts.yml # This example demonst...


