some grep alias:
g(){ grep \$1 /tmp/some_data.txt | sort -k1 | awk ' {print \$1 ,\"\t\", \$3 }';}
some mkdir alias:
mkcd() { mkdir -p -- "$1" && cd -P -- "$1"; }
put to:
vim ~/.bash_alias
source ~/.bash_alias
some grep alias:
g(){ grep \$1 /tmp/some_data.txt | sort -k1 | awk ' {print \$1 ,\"\t\", \$3 }';}
some mkdir alias:
mkcd() { mkdir -p -- "$1" && cd -P -- "$1"; }
put to:
vim ~/.bash_alias
source ~/.bash_alias
alias_Domains=(`grep -m1 -oP '(?<=ServerAlias ).*' /etc/apache2/sites-enabled/website.conf`)
paste from input to remote server ssh server_ip "cat - >> /tmp/some_file.txt" << "EOF" > asasas > asasas > asasas > EOF
echo "PUT YOUR MAIL BODY HERE" | mailx -s "SUBJECT" -S smtp=smtp://yoursmtpserver.com -S smtp-auth=login -S smtp-auth-user=YOUR_USERNAME -S smtp-auth-password=YOUR_PASSWORD -S from="Sender Name
echo "https://www.srv24x7.com/" | sed -e 's|^[^/]*//||' -e 's|/.*$||'
0 0 * * * /bin/bash -c 'for file in $(/bin/find /some/path -name "*.log"); do /usr/bin/tee -a $file; done'
:w !sudo tee % > /dev/null
starting with 192.x.x.x
cat ip_list.txt | grep -E "(192)(\.[0-9]{1,3}){3}"
starting with 192.168.x.x
cat ip_list.txt | grep -E "(192.168)(\.[0-9]{1,3}){2}"
starting with 192.168.10.x
cat ip_list.txt | grep -E "(192.168.10.)[0-9]{1,3}"
cat /tmp/ips.txt | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n
10.0.0.2
10.0.0.5
10.0.0.20
192.168.0.2
192.168.0.4
192.168.0.12
hide bash code using c:
apt install shc
shc -f mybash.sh
n=0; for i in `cat ttt` ; do readarray arr$n < <(ssh $i 'cat /etc/passwd'); n=$(( $n + 1 )) ; done
printf '%s\n' "${#arr0[@]}"
20
printf '%s\n' "${#arr1[@]}"
26
for l in 1 10 100 1000 10000 100000 1000000; do printf "%7s %s\n" $l "test string"; done
1 test string 10 test string 100 test string 1000 test string 10000 test string 100000 test string 1000000 test string
base64 /dev/urandom | head -c 1000 | sed "1 i\\`hostname`" | head -n 5
localhost.localdomain
brXE3yBW/afyXoZXigNc+bTaw71rW7Ykz9xFD01ZeXeglA/vubg9eJPmldDN3qQEOZongJbjSIEl
D6tu8lfhoYboc8eJTPPPasoQP1RcbdX/kVRbrxV2cLTaKVik2o3sywpjLZl+0Dow/9Of8iToahOw
JdWXPrkmsZZ9le4uN+qGU55Z2TO2Mc/baY0UUmBXaWX9NsNTsO4HwfqnT62Gs0BVtbMaWw0vWf3n
4QxJGcNl/gi5WUM/aamcUFe5exb8YlEk6Nj3szqf3b4DQE4XODe46W/4qCzg/UFzCb5SOC0YBnEa
0 0 * * * sleep `shuf -i 1-86400 -n 1`; mktemp
Run:
echo '0 0 * * * sleep `shuf -i 1-86400 -n 1`; mktemp' | sudo tee -a /var/spool/cron/$USER
expr $RANDOM % 14400 | tee >(xargs sleep)
vit 14357 0.0 0.0 215528 708 pts/8 S 14:21 0:00 xargs sleep
vit 14358 0.0 0.0 215220 704 pts/8 S 14:21 0:00 sleep 157