Skip to content

Instantly share code, notes, and snippets.

@heiswayi

heiswayi/.bashrc

Last active Jan 30, 2020
Embed
What would you like to do?
My LinuxLite .bashrc
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
alias usage='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'
alias ls="ls --color"
# Powerline
if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi
# Linux Lite Custom Terminal
LLVER=$(awk '{print}' /etc/llver)
echo -e "Welcome to $LLVER ${USER}"
echo " "
date "+%A %d %B %Y, %T"
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}'
echo " "
export PATH=/home/wayi/.local/bin:$PATH
eval $(dircolors -b $HOME/.dircolors)
cheat() {
curl "http://cheat.sh/$1"
}
man2txt() {
man "$1" | col -bx
}
manflags() {
man "$1" | awk '{$1=$1;print}' | grep "^\-"
} #man pages just the flags more or less, captures some extra
ubuman() {
w3m -dump "https://manpages.ubuntu.com/manpages/$(lsb_release -cs)/en/man1/"$1".1.html"
} # ubuntu web manpages note bionic, update with do release up
ubumanflags() {
w3m -dump "https://manpages.ubuntu.com/manpages/$(lsb_release -cs)/en/man1/$1.1.html" |
awk '{$1=$1;print}' | grep "^\-"
} # ubuntu web manpages
explain() {
if [ "$#" -eq 0 ]; then
while read -p "Command: " cmd; do
curl -Gs "https://www.mankier.com/api/v2/explain/?cols="$(tput cols) --data-urlencode "q=$cmd"
done
echo "Bye!"
elif [ "$#" -eq 1 ]; then
curl -Gs "https://www.mankier.com/api/v2/explain/?cols="$(tput cols) --data-urlencode "q=$1"
else
echo "Usage"
echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.