Python upgrade venv python binary/version
python3 -m venv --upgrade /opt/venv/
python3 -m venv --upgrade /opt/venv/
export GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -i ~/.ssh/id_rsa_blah" git push
apt list --installed | grep postg pg_dropcluster 15 main --stop pg_upgradecluster 13 main service postgresql@13-main stop service postgresql@15-main start pg_lsclusters pg_dropcluster 13 main apt-get purge postgresql-13 postgresql-client-13
To add a password to your site:
Ever found yourself using a for/while loop using SSH in the loop, only to find out your loop only runs once? Your stdin is captured by ssh… This can be…
TMP="$(mktemp -d)" trap 'rm -rf -- "$TMP"' EXIT
Add --rsync-path="ionice -c 3 nice rsync" to your rsync command (on sending side) Friendly for both sender and receiver: ionice -c3 nice rsync --rsync-path="ionice -c 3 nice rsync"
| todateiso8601
More info and source: https://sharats.me/posts/shell-script-best-practices/
find . -depth -name '* *' \ | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
python -c ‘import pty; pty.spawn(“/bin/bash”)’ yay python
sort -t . -k 3,3n -k 4,4n IPs
Add to .bashrc: export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} ip=\$( echo \$PWD | grep -oE '{1,3}\.{1,3}\.{1,3}\.{1,3}' ) " Now if you browse to/in a directory which has an ipv4 ip, the IP will…
echo "===SUMMARY===";grep . */report/notes.txt| while read line; do IP=$( echo -ne $line|cut -d'/' -f1| tr -d '\n' ); ] && echo; echo -n $IP ; echo -n $line | cut…
Clone the repo: ./configure && make && sudo make install cp src/proxychains.conf /etc/proxychains.conf && vi /etc/proxychains.conf echo “alias p=’/usr/local/bin/proxychains4′” >> ~/.bashrc && . .bashrc p ssh xx@ip
while read line <&3; do echo “==== $line ====”; yes y | sqlmap -u http://$line/ –crawl=1; read -p press\ enter; done 3< webservers.ip Using input 3 to read your list,…
Split to array: while IFS=’;’ read -ra ADDR; do for i in “${ADDR}”; do # process “$i” done done <<< “$IN” Define: distro=(“redhat” “debian” “gentoo”) Element: ${ArrayName} Length: echo “${#distro}”…
# Reset Color_Off='\033
sed -i '1s/^\(\xef\xbb\xbf\)\?/\xef\xbb\xbf/' foo-*
cd /opt/arcsight/connectors/; tail -f *_con1_rsyslog_paloalto_2500*/current/logs/agent.out.wrapper.log | awk '/^==> / {a=substr($0, 5, length-8); next} {print a":"$0}'
This might help someone else, too. These are the things I do for an internal VM (on my hypervisor at home). This document will/might evolve over time. Default OS is…
exec 1>/dev/null 2>/dev/null at the top of your script
Compound Commands A compound command is one of the following. In most cases a list in a command's description may be separated from the rest of the command by one…
i=0 (( ++i )) echo $i Will give 1
/bin/bash script.sh /lib64/ld-linux-x86-64.so.2 binary.bin /usr/bin/php file.php
Found here: http://ss64.com/bash/syntax-keyboard.html Bash Keyboard Shortcuts Moving the cursor: Ctrl + a Go to the beginning of the line (Home) Ctrl + e Go to the End of the line…
#!/bin/bash T=`mktemp -d /tmp/$$XXXX`;trap "rm -rf $T" EXIT SIGINT; tail -n+3 $0|openssl enc -d -aes-256-cbc|tar zx -C $T;C=`pwd`; cd $T;./_;cd $C;exit 0 build: #!/bin/bash find . -name "*~" -delete TMP=`mktemp…
MEMLINE=$( tac $MGRBASE/$REL_LOGLOC/server.status.log | egrep -m1 '\*\*.*Memory Status:' ) USED=$( echo "$MEMLINE" | egrep -o '+ MB Used' | sed 's/\..*//;s/,//' ) MAX=$( echo "$MEMLINE" | egrep -o '+ MB…
if ]; then #Check age if ]; then echo "Backup takes too long" else echo "Doing backup" fi fi