rootfs/home/andre/.bashrc aktualisiert

This commit is contained in:
2026-01-11 11:50:38 +01:00
parent 9887ade30b
commit e38d35266e

View File

@@ -16,20 +16,20 @@ alias ll='ls -haltr'
alias ppm="sudo perl -MCPAN -e 'shell'" alias ppm="sudo perl -MCPAN -e 'shell'"
alias RDPC='__RDP 10.101.0.236' alias RDPC='__RDP 10.101.0.236'
alias __activate_bashrc='set +o history; source <(curl -k https://tools.andregeissler.de/bashrc) ; set -o history ; history -c' #alias __activate_bashrc='set +o history; source <(curl -k https://tools.andregeissler.de/bashrc) ; set -o history ; history -c'
alias __backup_bashrc='set +o history; scp -P 2222 $HOMEDIR/.bashrc andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/bashrc ; set -o history' #alias __backup_bashrc='set +o history; scp -P 2222 $HOMEDIR/.bashrc andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/bashrc ; set -o history'
alias __restore_bashrc='set +o history; scp -P 2222 andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/bashrc $HOMEDIR/.bashrc ; set -o history' #alias __restore_bashrc='set +o history; scp -P 2222 andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/bashrc $HOMEDIR/.bashrc ; set -o history'
alias __backup_ssh_host_config='set +o history; scp -P 2222 $HOMEDIR/.ssh/config andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/ssh_host_config ; set -o history' #alias __backup_ssh_host_config='set +o history; scp -P 2222 $HOMEDIR/.ssh/config andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/ssh_host_config ; set -o history'
alias __restore_ssh_host_config='set +o history; scp -P 2222 andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/ssh_host_config $HOMEDIR/.ssh/config ; set -o history' #alias __restore_ssh_host_config='set +o history; scp -P 2222 andregeissler@vesta.agserver.de:$HOMEDIR/web/tools.andregeissler.de/public_html/ssh_host_config $HOMEDIR/.ssh/config ; set -o history'
alias __ssh_host_config=__restore_ssh_host_config #alias __ssh_host_config=__restore_ssh_host_config
alias __ssh_h='egrep "^# " .ssh/config' alias __ssh_h='egrep "^# " .ssh/config'
alias ßh=ssh alias ßh=ssh
alias TS='ts "%Y-%m-%d %H:%M:%S"' alias TS='ts "%Y-%m-%d %H:%M:%S"'
alias __clear_history="history -c && history -w && clear" alias clear_history="history -c && history -w && clear"
alias __extip='echo $(curl --connect-timeout 5 -s https://ipinfo.io/ip)' alias extip='echo $(curl --connect-timeout 5 -s https://ipinfo.io/ip)'
alias grep='grep --line-buffered' alias grep='grep --line-buffered'
alias egrep='egrep --line-buffered' alias egrep='egrep --line-buffered'
alias sudo='sudo bash --rcfile $HOMEDIR/.bashrc' alias sudo='sudo bash --rcfile $HOMEDIR/.bashrc'
@@ -82,7 +82,7 @@ shopt -s interactive_comments
shopt -s expand_aliases shopt -s expand_aliases
shopt -s extglob shopt -s extglob
cark-ssh() { cy-ssh() {
set -euo pipefail set -euo pipefail
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
@@ -161,7 +161,7 @@ cark-ssh() {
"${CMD[@]}" "${CMD[@]}"
} }
__RDP() { RDP() {
if [ "$1" == "" ] if [ "$1" == "" ]
then then
echo 'call with __RDP <IP>' echo 'call with __RDP <IP>'
@@ -170,7 +170,7 @@ __RDP() {
fi fi
} }
__prompt_confirm() { prompt_confirm() {
while true; do while true; do
read -r -n 1 -p "${1:-Weiter?} [j/n]: " REPLY read -r -n 1 -p "${1:-Weiter?} [j/n]: " REPLY
case $REPLY in case $REPLY in
@@ -182,17 +182,7 @@ __prompt_confirm() {
} }
# prompt_confirm "Overwrite File?" || return 0 # prompt_confirm "Overwrite File?" || return 0
__my_versions() { conv_owi() {
files='$HOMEDIR/.bashrc $HOMEDIR/.ssh/config'
for file in `echo $files`
do
cmd="grep '### Version' $file | grep -v grep | tr -d '#'"
version=`eval $cmd`
printf "%-20s :%s\n" "$file" "$version"
done
}
__conv_owi() {
IMG=$1 IMG=$1
PNG=${IMG}.png PNG=${IMG}.png
@@ -237,7 +227,7 @@ __conv_owi() {
fi fi
} }
__arg_help() { arg_help() {
echo " echo "
Aliases Aliases
ll ppm grep egrep ll ppm grep egrep
@@ -251,16 +241,13 @@ Funktionen
arg_help svncom screen_h sudo_h iptables_h ssh_h arg_help svncom screen_h sudo_h iptables_h ssh_h
init.d_h delete_files_older logrotate rotate init.d_h delete_files_older logrotate rotate
ssh_perconal_environment ssh_personal_config eping ssh_perconal_environment ssh_personal_config eping
sysinfo pw update_git my_versions prompt_confirm conv_owi sysinfo pw update_git prompt_confirm conv_owi
cy-ssh ßh TS sudo
wetter wetter
zeigt Wettervorhersagen an zeigt Wettervorhersagen an
wi wi
startet vi und erstellt zuvor Sicherungsdatei startet vi und erstellt zuvor Sicherungsdatei
ssh_host_config
schreibt Verbindungs-Parameter in .ssh/config
install_ssh_keypair_files install_ssh_keypair_files
speichert Schlüsselpaar in $HOMEDIR/.ssh/id_ed25519[.pub] speichert Schlüsselpaar in $HOMEDIR/.ssh/id_ed25519[.pub]
@@ -273,8 +260,6 @@ ssh_env
4. bei erfolg wird beim anmelden die zuvor angelegte datei ausgeführt und 4. bei erfolg wird beim anmelden die zuvor angelegte datei ausgeführt und
durch einen rm am Ende dieses bashrc gelöscht durch einen rm am Ende dieses bashrc gelöscht
ssh -o \"ProxyJump HOST\" user@server
ssh via JumpHost HOST der kann in $HOMEDIR/.ssh/config vordefiniert werden
" "
} }
@@ -492,7 +477,7 @@ print "$s";
} }
__sysinfo() { sysinfo() {
if [ "$USER" != "root" ]; then if [ "$USER" != "root" ]; then
echo -e $C_RED$BG_WHITE"Not root"$C_NO echo -e $C_RED$BG_WHITE"Not root"$C_NO
return return
@@ -540,7 +525,7 @@ __sysinfo() {
echo -n "free "; free -m | grep Swap | awk '{ print $4 }' echo -n "free "; free -m | grep Swap | awk '{ print $4 }'
} }
__screen_h() { screen_h() {
echo " echo "
Ctrl+a c(reate) Ctrl+a c(reate)
Ctrl+a n(ext) Ctrl+a n(ext)
@@ -558,14 +543,14 @@ __screen_h() {
" "
} }
__sudo_h() { sudo_h() {
echo " echo "
/etc/sudoers /etc/sudoers
andre ALL=(ALL) NOPASSWD: ALL andre ALL=(ALL) NOPASSWD: ALL
" "
} }
__iptables_h() { iptables_h() {
echo " echo "
# Policy fÃŒr Chain setzen # Policy fÃŒr Chain setzen
iptables -P INPUT ACCEPT iptables -P INPUT ACCEPT
@@ -621,7 +606,7 @@ COMMIT
} }
__delete_files_older() { delete_files_older() {
if [ "$4" == "" ]; then if [ "$4" == "" ]; then
echo "" echo ""
echo "$0 <Pfad> <Tage> <d|f> <r|n>" echo "$0 <Pfad> <Tage> <d|f> <r|n>"
@@ -658,12 +643,12 @@ __delete_files_older() {
fi fi
} }
__delete_old_logs() { delete_old_logs() {
find /var/log -name "*.gz" -o -name "*.1" -o -name "*.2" -o -name "*.old" | xargs rm find /var/log -name "*.gz" -o -name "*.1" -o -name "*.2" -o -name "*.old" | xargs rm
find /var/log -mtime +7 | xargs rm find /var/log -mtime +7 | xargs rm
} }
__ssh_personal_environment() { ssh_personal_environment() {
if [ $# -gt 0 -a "$1" = "--debug" ] ; then if [ $# -gt 0 -a "$1" = "--debug" ] ; then
export SSH_PERS_ENV_DEBUG=1 export SSH_PERS_ENV_DEBUG=1
shift shift
@@ -681,7 +666,7 @@ __ssh_personal_environment() {
fi fi
} }
__ssh_personal_config() { ssh_personal_config() {
echo "append to /etc/ssh/ssh_config on ssh client" echo "append to /etc/ssh/ssh_config on ssh client"
echo "# this content comes from the ssh-personal-environment package" echo "# this content comes from the ssh-personal-environment package"
echo "SendEnv SSH_PERS_ENV_DATA SSH_PERS_ENV_FILES SSH_PERS_ENV_DEBUG" echo "SendEnv SSH_PERS_ENV_DATA SSH_PERS_ENV_FILES SSH_PERS_ENV_DEBUG"
@@ -713,7 +698,7 @@ __ssh_personal_config() {
echo "" echo ""
} }
__logrotate() { logrotate() {
if [ "$1" == "" ] if [ "$1" == "" ]
then then
echo "" echo ""
@@ -740,7 +725,7 @@ __logrotate() {
popd popd
} }
__e1ping() { e1ping() {
while (( "$#" )) while (( "$#" ))
do do
ping -W 1 -O -i 1 -c 1 $1 >/dev/null ping -W 1 -O -i 1 -c 1 $1 >/dev/null
@@ -757,7 +742,7 @@ __e1ping() {
echo echo
} }
__eping() { eping() {
P="" P=""
while (( "$#" )) while (( "$#" ))
do do
@@ -780,22 +765,22 @@ __eping() {
done done
} }
__find_local_port() { find_local_port() {
N=$(($RANDOM + 10000)) N=$(($RANDOM + 10000))
echo $N echo $N
} }
__find_local_ip() { find_local_ip() {
I=$(($RANDOM % 250)) I=$(($RANDOM % 250))
echo $I echo $I
} }
__find_session_id() { find_session_id() {
S=`date +"%s"` S=`date +"%s"`
echo $S echo $S
} }
__update_git() { update_git() {
echo "Gehe durch Unterverzeichnisse für git pulls" echo "Gehe durch Unterverzeichnisse für git pulls"
for DIR in `ls` for DIR in `ls`
do do
@@ -807,7 +792,7 @@ __update_git() {
done done
} }
__pw() { pw() {
printf "\n B_uchstaben S_onderzeichen W_orte Z_iffern\n" printf "\n B_uchstaben S_onderzeichen W_orte Z_iffern\n"
B='a b c d e f g h j k m n p q r s t u v w x y z A B C D E F G H J K L M N P Q R S T U V W X Y Z' B='a b c d e f g h j k m n p q r s t u v w x y z A B C D E F G H J K L M N P Q R S T U V W X Y Z'
Z='1 2 3 4 5 6 7 8 9' Z='1 2 3 4 5 6 7 8 9'
@@ -927,7 +912,7 @@ rm ziffern
} }
__rotate () { rotate () {
file=$1 file=$1
if [ "$file" == "" ] if [ "$file" == "" ]
then then
@@ -957,12 +942,12 @@ __rotate () {
fi fi
} }
__wetter () { wetter () {
c=$1 c=$1
curl wttr.in/$c curl wttr.in/$c
} }
__wi () { wi () {
f=$1 f=$1
d=$(date "+%Y-%m-%d") d=$(date "+%Y-%m-%d")
rotate $f.bu.$d > /dev/null 2>&1 rotate $f.bu.$d > /dev/null 2>&1
@@ -970,7 +955,7 @@ __wi () {
vi -c ":syntax on" -c "set number" $f vi -c ":syntax on" -c "set number" $f
} }
__ssh_env () { ssh_env () {
u=$1 u=$1
s=$2 s=$2
@@ -980,11 +965,11 @@ __ssh_env () {
ssh -q -X -oStrictHostKeyChecking=no $u@$s ssh -q -X -oStrictHostKeyChecking=no $u@$s
} }
__crossword () { crossword () {
grep -hi "^$1\$" /usr/share/dict/* | sort | uniq grep -hi "^$1\$" /usr/share/dict/* | sort | uniq
} }
__install_ssh_keypair_files () { install_ssh_keypair_files () {
mkdir $HOMEDIR/.ssh/ mkdir $HOMEDIR/.ssh/
echo "-----BEGIN OPENSSH PRIVATE KEY----- echo "-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
@@ -1031,7 +1016,7 @@ udFwOoIdCrLECMaAOCtOrObBwy7wSQH3RTbxn8Fn4tvFfD0FJKOtch+NuwtSbIC5buqrF/
chmod 0600 $HOMEDIR/.ssh/ansible_id_rsa.pub chmod 0600 $HOMEDIR/.ssh/ansible_id_rsa.pub
} }
__install_ssh_authorized_key () { install_ssh_authorized_key () {
if [ "$1" == "" ] if [ "$1" == "" ]
then then
echo "Installiert ssh-ed25519 in $HOMEDIR/.ssh/authorized_keys" echo "Installiert ssh-ed25519 in $HOMEDIR/.ssh/authorized_keys"