6/14/2016

Commonly used Linux Aliases

EDITOR='TERM=xterm-256color emacs -nw';
export EDITOR
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.5.0/5.5/gcc_64/lib
alias loadmac='sudo mount -t vboxsf -o dmode=755,fmode=644,uid=$UID,gid=$(id -g) Share ~/machome'
                                                                
export PS1='[\D{%Y/%m/%d} \t]${debian_chroot:+($debian_chroot)}\[\033[00;34m\]\u@\h\[\033[00m\]: \[\033[00;31m\]\w\[\033[00m\]\$ '
export CLICOLOR=1
export LS_COLORS='rs=0:di=01;34:mh=00:pi=40;33:so=00;97;44:do=00;97;44:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:*.tar=00;97;44:*.tgz=00;97;44:*.arc=00;97;44:*.arj=00;97;44:*.taz=00;97;44:*.lha=00;97;44:*.lz4=00;97;44:*.lzh=00;97;44:*.lzma=00;97;44:*.tlz=00;97;44:*.txz=00;97;44:*.tzo=00;97;44:*.t7z=00;97;44:*.zip=00;97;44:*.z=00;97;44:*.Z=00;97;44:*.dz=00;97;44:*.gz=00;97;44:*.lrz=00;97;44:*.lz=00;97;44:*.lzo=00;97;44:*.xz=00;97;44:*.bz2=00;97;44:*.bz=00;97;44:*.tbz=00;97;44:*.tbz2=00;97;44:*.tz=00;97;44:*.deb=00;97;44:*.rpm=00;97;44:*.jar=00;97;44:*.war=00;97;44:*.ear=00;97;44:*.sar=00;97;44:*.rar=00;97;44:*.alz=00;97;44:*.ace=00;97;44:*.zoo=00;97;44:*.cpio=00;97;44:*.7z=00;97;44:*.rz=00;97;44:*.cab=00;97;44:*.jpg=00;97;44:*.jpeg=00;97;44:*.gif=00;97;44:*.bmp=00;97;44:*.pbm=00;97;44:*.pgm=00;97;44:*.ppm=00;97;44:*.tga=00;97;44:*.xbm=00;97;44:*.xpm=00;97;44:*.tif=00;97;44:*.tiff=00;97;44:*.png=00;97;44:*.svg=00;97;44:*.svgz=00;97;44:*.mng=00;97;44:*.pcx=00;97;44:*.mov=00;97;44:*.mpg=00;97;44:*.mpeg=00;97;44:*.m2v=00;97;44:*.mkv=00;97;44:*.webm=00;97;44:*.ogm=00;97;44:*.mp4=00;97;44:*.m4v=00;97;44:*.mp4v=00;97;44:*.vob=00;97;44:*.qt=00;97;44:*.nuv=00;97;44:*.wmv=00;97;44:*.asf=00;97;44:*.rm=00;97;44:*.rmvb=00;97;44:*.flc=00;97;44:*.avi=00;97;44:*.fli=00;97;44:*.flv=00;97;44:*.gl=00;97;44:*.dl=00;97;44:*.xcf=00;97;44:*.xwd=00;97;44:*.yuv=00;97;44:*.cgm=00;97;44:*.emf=00;97;44:*.ogv=00;97;44:*.ogx=00;97;44:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36::ex=0;35:ln=01;102:'
# Set Hadoop-related environment variables
export HADOOP_HOME=/usr/local/hadoop
export PATH="$PATH:$HOME/bin:$HADOOP_HOME/bin:/usr/local/apache-maven-3.3.9/bin"

alias scp='scp -3'
alias emacs='TERM=xterm-256color emacs -nw'
alias up='cd ..'
alias up2='cd .. && cd ..'
alias up3='cd .. && cd .. && cd ..'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias bcc='bazel build'
alias eclipse='~/Documents/eclipse/eclipse'

alias gdiff='git log -p -n 1'
alias gfiles='git log -n 1 --name-only'
alias g='git'
alias gb='git branch'
alias gs='git status'
alias gr='git review'
alias gm='git checkout master'
alias gc='git checkout'

alias fs='env WINEPREFIX="/home/liangzou/.wine" wine "/home/liangzou/.wine/drive_c/Program Files (x86)/FastStone Image Viewer/FSViewer.exe"'
alias h='history'
alias cls='clear'
alias knowledge='firefox "link to the knowledge.txt online file"'
alias hfs="hadoop fs"
alias hls="fs -ls"
alias bashrc="scite ~/.bashrc &"
alias l='ls --color'
alias ll='ls -lh --color'
alias lname='ls | tr "\n" "\n"'
alias emacs='TERM=xterm-256color emacs -nw'
alias e='emacs'
alias ew='LC_CTYPE=zh_CN.UTF-8 /usr/bin/emacs -fh -geometry 180x0'
# If HDPI screen
# alias ew='GDK_SCALE= /usr/bin/emacs -fh --geometry 90x40'
# For X11 forwarding app
alias xew='/usr/bin/emacs --geometry 90x52 -q --load ~/.x11emacs'
alias b='bazel'
alias s='scite'
alias start='nemo'
# for cygwin
# alias start='cygstart'
alias eclipse='~/Documents/eclipse/eclipse'
alias d='docker'
alias dm='docker-machine'
alias intellij='~/Documents/idea-IC-145.597.3/bin/idea.sh &'
alias n='nodejs'
alias k='kubectl'
alias chrome='/opt/google/chrome/chrome'
alias tm='trash'
alias loadbuildenv='docker run -it --rm -v /home/$USER:/main/user 776923679937.dkr.ecr.us-west-2.amazonaws.com/buildenv:latest'
alias r='pkill -HUP -f "cinnamon --replace"'
alias a='aws'
alias t='tree'
alias large='export GDK_SCALE=2'
alias xeclipse='GDK_DPI_SCALE=2 eclipse' 
alias gbackup='g push origin HEAD:refs/for/master%wip'
alias sftptunnel='ssh -D 8001 -p 2002 deepmap'
alias sshtunnel='ssh -L 8002:depot0:22 -p 2002 deepmap'
alias sshvrtunnel='ssh -L 8065:10.1.20.65:22 -p 2002 deepmap'

alias m='netease-cloud-music --force-device-scale-factor=2'
alias screen='TERM=xterm-256color screen'

alias fixterminal='stty sane'

alias work='cd ~/gitreview/deepmap'
alias workbase='cd ~/gitreview/deepmap/deepmap-base'
alias vpn='cd ~/bin/ && sudo ./cclient.sh start --load'
alias evpn='expressvpn'
alias winr='taskkill /F /IM explorer.exe && start explorer.exe'

alias phonec='adb connect 10.12.7.179:7612 && scrcpy --push-target /storage/emulated/0/Download/ --turn-screen-off'
alias phoneh='adb connect 192.168.124.22:7612 && scrcpy --push-target /storage/emulated/0/Download/ --turn-screen-off'
alias re='retext'
alias p='python'


# Change cursor to red
echo -ne '\e]12;#ff0000\a'

# Add a function to change title
function bb() {
      echo -ne "\e]0;$1\a"

}

function ediff() {
  if [ "X${2}" = "X" ]; then
    echo "USAGE: ediff "
  else
    # The --eval flag takes lisp code and evaluates it with EMACS
    emacs --eval "(ediff-files \"$1\" \"$2\")"
  fi
}

# Git branch bash completion
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash

  # Add git completion to aliases
  __git_complete g __git_main
  __git_complete gc _git_checkout
  __git_complete gm __git_merge
  __git_complete gp _git_pull

fi


------

DO NOT COPY TO .bashrc // Reference:
0   = default colour
1   = bold
4   = underlined
5   = flashing text
7   = reverse field
31  = red
32  = green
33  = orange
34  = blue
35  = purple
36  = cyan
37  = grey
40  = black background
41  = red background
42  = green background
43  = orange background
44  = blue background
45  = purple background
46  = cyan background
47  = grey background
90  = dark grey
91  = light red
92  = light green
93  = yellow
94  = light blue
95  = light purple
96  = turquoise
97  = white
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background

No comments: