Friendly (ionice/nice) rsync on remote server
Add --rsync-path="ionice -c 3 nice rsync" to your rsync command (on sending side)
Add --rsync-path="ionice -c 3 nice rsync" to your rsync command (on sending side)
| todateiso8601
#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then echo…
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: https://github.com/rofl0r/proxychains-ng ./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[0m' # Text Reset # Regular Colors Black='\033[0;30m' # Black Red='\033[0;31m' # Red Green='\033[0;32m' # Green Yellow='\033[0;33m' # Yellow Blue='\033[0;34m' # Blue Purple='\033[0;35m' # Purple Cyan='\033[0;36m' # Cyan…
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
MySQL for puppet dashboard gets BIG. You can make this smaller by deleting old records. Source for this article is here. To get the size in GB of the dashboard:…
Get the full path of a file via: $ readlink -f ./file Tip: make an alias: alias fullpath='readlink -f'
This might be helpful for someone. A quick script I made for changing output modes on my Dell laptop. There are different configurations. laptop: laptop screen only vga: vga output…
Adjust to your needs ;) #!/bin/bash # Create puppet module layout if ];then echo "$0 modulename" exit 1 fi if ]; then echo "Dir already exists" exit 1 fi #…
I have a scheduled.txt file like this: # Scheduled tasks for todo.txt # Format: # # a dow, Mon,Tue,Wed,... # b moy, Jan,Feb,Mar,... # d dom, 01..31 # D m/d/y…
Add this to your .bashrc: clippy() { echo "I see you're trying to use the terminal …"; echo " v "; echo " ╭─╮"; echo " ⌾ ⌾"; echo "…
Clear the BASH history easily via: $ >~/.bash_history Remember to log out after doing this.