Skip to content

Instantly share code, notes, and snippets.

@superhero
Last active August 21, 2020 04:26
Show Gist options
  • Save superhero/f06b071ec70e385f5ae4a5f274e352f1 to your computer and use it in GitHub Desktop.
Save superhero/f06b071ec70e385f5ae4a5f274e352f1 to your computer and use it in GitHub Desktop.
# settig default permissions, r/rw to your user and your default group
umask 0002
# return if not running interactively
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history
HISTCONTROL=ignoreboth:erasedups
# ignores placing the exit command in history
HISTIGNORE="&:ls:[bf]g:exit:pwd:clear:mount:umount:[ \t]*"
# setting history length
HISTSIZE=-1
HISTFILESIZE=10000
# update the values of LINES and COLUMNS after the window size
shopt -s checkwinsize
# append to the history file
shopt -s histappend
# sync between bash sessions
# PROMPT_COMMAND="history -n; history -a; history -w"
# Bash history completion bound to arrow keys (down, up)
# bind '"\e[A": history-search-backward'
# bind '"\e[B": history-search-forward'
# ask before overwriting when copy
alias cp='cp -i'
# grep colors
alias grep='grep --color=auto'
# ls colors and grouping
alias ls='ls --human-readable --color=auto --group-directories-first'
export LS_COLORS="fi=97:di=1;36:ln=35:or=1;31:mi=1;31:ex=36"
# color GCC
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# exposes the git branch, if there's one
git_branch()
{
gitstatus=`git status 2> /dev/null`
git branch 2> /dev/null | sed -e '/^[^*]/d' -e $'s/* \\(.*\\)/\u2387 \\1 /'
}
# prompt colors & title format
export PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \w\a\]\[\e[1;36m\]\u@\h\[\e[m\] \[\e[1;35m\]\w\[\e[m\] \[\e[1;34m\]\$(git_branch)\[\e[1;32m\]\\$\[\e[m\] "
export PS2="\[\e[1;92m\]->\[\e[m\] "
# in debian, commands such as ifconfig wont work for none root users with out this line ...
export PATH=$PATH:/sbin
# cd and list
function cl()
{
cd "$@";
count=$(ls -B1h | wc -l);
if [ "$count" -gt "100" ];
then echo -e "\033[0;35m$count\033[0m entries in \033[1;35m$(pwd)\033[0m";
else ls -Blh;
fi
}
alias cd=cl
# cdn 2 = cd ../../
function cdn()
{
cmd=""
for (( i=0; i < $1; i++))
do
cmd="$cmd../"
done
cd "$cmd"
}
# manual colors
man()
{
env LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;35m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;31m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
# extract archives
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar -xJf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
# enable programmable completion features
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
echo "
▒███░ ░████████▒
█████▒░█████░▒▒▒▒▒▒█████
██▒▒▒▒██████████████▒▒▒██░
██▒▒▒▒███▒██▒██▒▒█████▒░▒██
█░▒▒▒██▒████████████▒█▒▒▒█░
█▒▒▒▒██▒▒▒░▓▓▒░▓▒▒████▒▒██
█▒▒▒▒██▒▒▒▒▒▒▒▒▒▒▒█▒█░▒████
███████████▒▒▒▒▒▒▒▒██████▒██▓▒███
██▒▒▒▒▒▒█████▒▒▒▒▒▒▒▒█████▒▒▒▒▒██
██▒▒▒▒▒▒▒▓██████▒▒▒▒▒██▒▒▒▒▒▒███
█████▒▒▒▒▒▒▒▒▒▒████▒▒▒██▒▒▒▒▒▒███
██▒▒▒███▒▒▒▒▒▒▒▒▒▒▓█████▒▒▒▒▒███
███▒▒▒▒███▒▒▒▒▒▒▒▒▒▒▒███▓▒▒███
█████▒▒████▒▒▒▒▒▒▒▒▒▒█████
████▒▒██████▒▒▒▒█████
███▒▒██████████
████▓ █▓█
████
█░█ █████████
█▓█ █████████████
░█████████ ████ ██▓███▒▓████
█████████████ █░███████░██████
████░▒███▒██ █▓██████████
█████▓▒█████ ████
██████████▓█
█▓█ ████▒█▓▒█
█▓██ █████████████
█▓█ ██▒████░█████
██████████▒██████
█▓███████████
████
█▒█
███
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment