Created
May 24, 2021 15:01
-
-
Save GiulioCentorame/1382c4c0d6b078ba8a3c91bf4eb84fc1 to your computer and use it in GitHub Desktop.
Bash profile configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bash_profile | |
# Get the aliases and functions | |
if [ -f ~/.bashrc ]; then | |
. ~/.bashrc | |
fi | |
# User specific environment and startup programs | |
################################################# | |
# Aliases | |
alias rm='rm -i' # confirm before removing something | |
alias cp='cp -i' # confirm before overwriting something | |
alias mv='mv -i' # confirm before renaming something | |
alias df='df -h' # human-readable sizes | |
alias du='du -h' # same | |
alias more=less | |
alias diskspace="du -Sh | sort -n -r | less" # check diskspace usage | |
alias ll='ls -alh' # list with size, permissions, user etc | |
alias la='ls -A' # show hidden files | |
alias l='ls -CFlh' # tidier regular ls | |
alias lsd="ls -alF | grep /$" | |
# Global extractor | |
extract() { | |
if [ -f $1 ]; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar 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 "$1 cannot be extracted via extract()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file!" | |
fi | |
} | |
# Up n folders | |
up() { | |
cd $(eval printf '../'%.0s {1..$1}) && pwd | |
} | |
# Pretty manpages | |
export LESS_TERMCAP_mb=$'\E[01;31m' | |
export LESS_TERMCAP_md=$'\E[01;31m' | |
export LESS_TERMCAP_me=$'\E[0m' | |
export LESS_TERMCAP_se=$'\E[0m' | |
export LESS_TERMCAP_so=$'\E[01;44;33m' | |
export LESS_TERMCAP_ue=$'\E[0m' | |
export LESS_TERMCAP_us=$'\E[01;32m' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment