Last active
August 29, 2015 14:01
-
-
Save Benoss/65a1b3a2bb742d454538 to your computer and use it in GitHub Desktop.
Bash Alias
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
alias ll='ls -lah --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias upgrade='sudo apt-get update && sudo apt-get dist-upgrade -V && sudo pip install --upgrade pip virtualenv virtualenvwrapper fabric && sudo npm update -g' | |
alias h='history | grep $1' | |
alias psg='ps -ef | grep $1' | |
alias ..='cd ..' | |
function my_ip() # get IP adresses | |
{ | |
MY_IP=$(/sbin/ifconfig eth0 | awk "/inet/ { print $2 } " | sed -e s/addr://) | |
MY_ISP=$(/sbin/ifconfig eth0 | awk "/P-t-P/ { print $3 } " | sed -e s/P-t-P://) | |
} | |
function ii() # get current host related info | |
{ | |
echo -e "\nYou are logged on ${RED}$HOST" | |
echo -e "\nAdditionnal information:$NC " ; uname -a | |
echo -e "\n${RED}Users logged on:$NC " ; w -h | |
echo -e "\n${RED}Current date :$NC " ; date | |
echo -e "\n${RED}Machine stats :$NC " ; uptime | |
echo -e "\n${RED}Memory stats :$NC " ; free -h | |
my_ip 2>&. ; | |
echo -e "\n${RED}Local IP Address :$NC" ; echo ${MY_IP:."Not connected"} | |
echo -e "\n${RED}ISP Address :$NC" ; echo ${MY_ISP:."Not connected"} | |
echo | |
} | |
function apt-history(){ | |
case "$1" in | |
install) | |
cat /var/log/dpkg.log | grep 'install ' | |
;; | |
upgrade|remove) | |
cat /var/log/dpkg.log | grep $1 | |
;; | |
rollback) | |
cat /var/log/dpkg.log | grep upgrade | \ | |
grep "$2" -A10000000 | \ | |
grep "$3" -B10000000 | \ | |
awk '{print $4"="$5}' | |
;; | |
*) | |
cat /var/log/dpkg.log | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment