-
-
Save stenrdj/bb4995dfda4818ce999d33d8e2fa28c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
### --- 04/18/18 | elementaryOS --- ### | |
alias gc='git commit -am' | |
alias lsd='ls -la' | |
alias gco='git co' | |
alias gs="git status" | |
# ls aliases | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias d="ls -G" | |
alias lsd="ls -lahG" | |
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' | |
# Become system administrator | |
alias god='sudo -i' | |
alias root='sudo -i' | |
# For nano editor | |
alias nano='nano -w' | |
# apt-get aliases | |
alias apt-install='sudo apt-get install' | |
alias apt-search='apt-cache search' | |
alias apt-show='apt-cache show' | |
alias apt-purge='sudo apt-get --purge remove' | |
alias apt-remove='sudo apt-get remove' | |
alias apt-up="sudo apt-get update && sudo apt-get upgrade" | |
alias apt-policy="LANG=C apt-cache policy" | |
# Other | |
alias emacs='emacs22-gtk' | |
alias emacsfs='emacs22-gtk -fs' | |
alias gohome='cd ~; clear' | |
alias h='head' | |
alias ls='ls --color=auto' | |
alias reload='source $HOME/.bashrc' | |
alias showalias='cat $HOME/.bash_alias' | |
alias shr='shred -u ' | |
alias t='tail' | |
alias temps='acpi -t' | |
alias 'make_me_a_sandwich'='echo "What? Make it yourself"' | |
alias 'sudo_make_me_a_sandwich'='echo "ok"' | |
#find file | |
alias f='find . |grep ' | |
#search history | |
alias h='history|grep ' | |
#search processes | |
alias p='ps aux |grep ' | |
#open any file or folder with default app | |
alias o='xdg-open ' | |
#python calculator | |
alias pc='python -i -Qnew -c "from math import *"' | |
#python calculator (plus numpy and matplotlib) | |
alias pcn='python -i -Qnew -c "from math import *;from pylab import *"' | |
# Cool! | |
alias !='sudo' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
alias ....='cd ../../..' | |
man2pdf() { | |
if [[ -z $1 ]]; then | |
echo "USAGE: man2pdf [manpage]" | |
else | |
if [[ `find /usr/share/man -name $1\* | wc -l` -gt 0 ]]; then | |
out=/tmp/$1.pdf | |
if [[ ! -e $out ]]; then | |
man -t $1 | ps2pdf - > $out | |
fi | |
if [[ -e $out ]]; then | |
/usr/bin/evince $out | |
fi | |
else | |
echo "ERROR: manpage \"$1\" not found." | |
fi | |
fi | |
} | |
# perform 'ls' after 'cd' if successful. | |
cdls() { | |
builtin cd "$*" | |
RESULT=$? | |
if [ "$RESULT" -eq 0 ]; then | |
lsa | |
fi | |
} | |
# alias the function just defined | |
alias cd='cdls' | |
############################################### | |
# common on my system, your mileage may vary... | |
alias cdp="cd ~/Projects" | |
alias gs="git status" | |
alias gca="git commit -am" | |
alias mysqlstart="mysql.server start" | |
alias my-sql="mysql -u root -p" | |
############################################### | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" | |
local WHITE="\[\033[1;37m\]" | |
local LIGHT_GRAY="\[\033[0;37m\]" | |
local DARK_GRAY="\[\033[1;30m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local TEAL="\[\033[0;36m\]" | |
local LIGHT_TEAL="\[\033[1;36m\]" | |
case $TERM in | |
xterm*) | |
TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
TITLEBAR="" | |
;; | |
esac | |
PS1="${TITLEBAR}\ | |
$GREEN{$YELLOW\$(date +%H:%M)$GREEN}\ | |
$LIGHT_GREEN={$LIGHT_GRAY\u@\h:$WHITE\w$RED\$(parse_git_branch)$LIGHT_GREEN}=>$GREEN " | |
PS2='> ' | |
PS4='+ ' | |
} | |
proml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment