config/bash/aliases: update status and fix prompt exit code
This commit is contained in:
parent
4cde39d48e
commit
c5382934e1
|
@ -39,24 +39,31 @@ xtrace () {
|
||||||
set +x
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
highlight() { echo "[4m$1[0m"; }
|
highlight() { echo; echo "[4m$1[0m"; }
|
||||||
status() {
|
status() {
|
||||||
highlight 'System'
|
highlight 'System'
|
||||||
free -h
|
|
||||||
df -h -T --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=overlay
|
df -h -T --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=overlay
|
||||||
zfs list -d 0
|
zfs list -d 0 2>/dev/null
|
||||||
sudo certbot certificates
|
free -h
|
||||||
|
sudo certbot certificates 2>/dev/null
|
||||||
|
|
||||||
highlight 'Internet'
|
highlight 'Internet'
|
||||||
#--color=always
|
#--color=always
|
||||||
ip -brief address | grep --color=none -E '^(wl|en|tun|vmbr)'
|
ip -brief address | grep --color=none -E '^(wl|en|tun|vmbr)'
|
||||||
ip route
|
ip route
|
||||||
echo -n 'IPv4: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -4
|
echo -n 'IPv4: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -4
|
||||||
echo -n 'IPv6: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -6
|
echo -n 'IPv6: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -6
|
||||||
|
|
||||||
highlight 'Programs'
|
highlight 'Programs'
|
||||||
tmux ls
|
tmux ls 2>/dev/null
|
||||||
$sudo systemctl --no-pager list-units --failed || service --status-all
|
$sudo systemctl --no-pager list-units --failed --no-legend || service --status-all
|
||||||
if type docker >/dev/null
|
echo '== WEBSERVER'
|
||||||
then $sudo docker ps || $sudo systemctl status docker
|
{ sudo lsof -i :443 || sudo lsof -i :80; } | head -4
|
||||||
|
echo
|
||||||
|
if type docker &>/dev/null
|
||||||
|
then
|
||||||
|
echo '== DOCKER'
|
||||||
|
$sudo docker ps || $sudo systemctl status docker
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +74,9 @@ disks() {
|
||||||
sudo fdisk -l
|
sudo fdisk -l
|
||||||
} | less
|
} | less
|
||||||
}
|
}
|
||||||
|
scandisks() {
|
||||||
|
for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done
|
||||||
|
}
|
||||||
|
|
||||||
__u="$sudo apt update && $sudo apt upgrade"
|
__u="$sudo apt update && $sudo apt upgrade"
|
||||||
alias u="$__u"
|
alias u="$__u"
|
||||||
|
@ -121,8 +131,8 @@ shopt -oq posix || src /etc/bash_completion
|
||||||
|
|
||||||
# Fancy prompt
|
# Fancy prompt
|
||||||
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]"
|
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]"
|
||||||
PS1="$PS1 \`if [ \$? = 0 ]; then echo -e '\[\033[01;32m\]:)';"
|
PS1="$PS1 \`exitcode=\${?}; if test \$exitcode = 0; then printf '\[\033[01;32m\] :)';"
|
||||||
PS1="$PS1 else echo -e '\[\033[01;31m\]' \$?; fi\`\[\033[00m\]"
|
PS1="$PS1 else printf '\[\033[01;31m\]%3d' \$exitcode; fi\`\[\033[00m\]"
|
||||||
;;
|
;;
|
||||||
(*zsh) setopt sh_word_split;;
|
(*zsh) setopt sh_word_split;;
|
||||||
esac
|
esac
|
||||||
|
@ -130,4 +140,4 @@ esac
|
||||||
src /usr/share/git/completion/git-prompt.sh && PS1="$PS1\$(__git_ps1 \" (%s)\")"
|
src /usr/share/git/completion/git-prompt.sh && PS1="$PS1\$(__git_ps1 \" (%s)\")"
|
||||||
src $HOME/.config/shell/functions
|
src $HOME/.config/shell/functions
|
||||||
|
|
||||||
PS1="$PS1 \$ "
|
PS1="$PS1 \`test \$UID = 0 && printf '#' || printf '$'\` "
|
||||||
|
|
Loading…
Reference in New Issue