Skip to content

Instantly share code, notes, and snippets.

@oddlyzen
Last active April 8, 2018 02:49
Show Gist options
  • Save oddlyzen/c39d52fe4971e6e876f1b615e65d19d5 to your computer and use it in GitHub Desktop.
Save oddlyzen/c39d52fe4971e6e876f1b615e65d19d5 to your computer and use it in GitHub Desktop.
Awesome aliases for your Linux Mint.
# 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 ~/Desktop/Projects"
alias gs="git status"
alias gca="git commit -am"
alias mysqlstart="mysql.server start"
alias my-sql="mysql -u root -p"
###############################################
@voyeg3r
Copy link

voyeg3r commented Dec 23, 2017

make a new directory and enter it

mkcd () {
mkdir -pv -p "$@" && cd $_
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment