Advertisement
mayankjoin1

Final Useful linux alias

Sep 12th, 2015
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.77 KB | None | 0 0
  1. #Mayank's Final Alias. Mayank@  IITGuwahati. Thankyou various websites, google, forums, posts :)
  2. #Default editor is Sublime with executable subl . you can change that !
  3. #alias cp="cp -i"                          # confirm before overwriting something
  4. #alias grep='grep --color=tty -d skip'
  5. #alias in='yaourt --noconfirm'
  6. #alias l='ls -lBohc'
  7. #alias rs='rsync -avz --progress --fuzzy -e "ssh"'
  8. #alias text='gedit &'
  9. alias ....='cd ../../../../'
  10. alias ...='cd ../../../'
  11. alias ..='cd ..'
  12. alias .4='cd ../../../../'
  13. alias .5='cd ../../../../..'
  14. alias a='echo "------------Your aliases------------";alias'
  15. alias c='cd /run/media/u/'
  16. alias cd..='cd ..'
  17. alias cdd='cd ~/Desktop'
  18. alias cddoc='cd ~/Documents'
  19. alias cddown='cd ~/Downloads'
  20. alias cdm='cd ~/Music'
  21. alias cdv='cd ~/Videos'
  22. alias chr='chmod 644'
  23. alias chx='chmod 755'
  24. alias c=clear
  25. alias d='python2.7 /usr/local/bin/d.py &'
  26. alias df="df -Th --total"
  27. alias du="du -ach | sort -h"
  28. alias e='exit'
  29. alias egrep='egrep --color=auto'
  30. alias explore='nautilus .'
  31. alias fgrep='fgrep --color=auto'
  32. alias fhere="find . -name "
  33. alias free="free -mt"
  34. alias freemem='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches'
  35. alias g='git'
  36. alias go=gnome-open
  37. alias grep='grep --color=auto'
  38. alias h='history'
  39. alias historyc='history | cut -c 8-'
  40. alias hs='history | grep -i $1'
  41. alias i='sudo apt-get install '
  42. alias init0='sudo shutdown –h now'    #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"
  43. alias iy='sudo apt-get install -y'
  44. alias k='killall chrome firefox thunderbird -q'
  45. alias l='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
  46. alias la='ls -lah --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
  47. alias ldir='ls -l | grep ^d'
  48. alias ll='ls -lh --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
  49. alias lla='ll -A' # hidden
  50. alias lock='gnome-screensaver-command --lock'
  51. alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
  52. alias lsl="ls -lhFA | less"
  53. alias mkdir="mkdir -pv"
  54. alias mount='mount |column -t'
  55. alias pdfcrop='pdfcrop --margins "2  2  2 2" '
  56. alias ps="ps auxf"
  57. alias psg='ps aux | grep -i $1'
  58. alias q='exit'
  59. alias reboot='sudo reboot'      #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"
  60. alias restart='sudo poweroff'      #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"
  61. alias r='sudo reboot'      #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"
  62. alias rmf='rm -rf'
  63. alias rsd='rsync -avz --progress --delete-after --fuzzy -e "ssh"'
  64. alias s='subl'
  65. alias sa='source ~/.bashrc;echo "Bash aliases sourced."'
  66. alias se='apt-cache search '
  67. alias search='apt-cache search '
  68. alias shutdown='sudo shutdown –h now'    #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"
  69. alias sl="ls"
  70. alias so='source ~/.bashrc'
  71. alias suexplore='sudo nautilus .'
  72. alias suspend='sudo pm-suspend'
  73. alias sutext='gksudo gedit &'
  74. alias svim='sudo vim'
  75. alias text='subl &'
  76. alias tgz='tar -zxvf'
  77. alias top="htop"
  78. alias topf='find . -type f -print0 | xargs -0 du -h | sort -hr | head -n 100'
  79. alias try='gnome-open'
  80. alias unrar='rar e'
  81. alias up='sudo apt-get update'
  82. alias update='sudo apt-get update'
  83. alias wget="wget -c"
  84. alias x='localc'
  85. alias z='sudo ' # the space allows for command name expansion.
  86.  
  87. #Let's start off by demonstrating an extremely useful bash function. This one will create a directory and then immediately move into that directory. This is usually exactly the sequence we take when making new directories:
  88.  
  89. mcd () {
  90.     mkdir -p $1
  91.     cd $1
  92. }
  93.  
  94. function ex {
  95.  if [ -z "$1" ]; then
  96.     # display usage if no parameters given
  97.     echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
  98.  else
  99.     if [ -f $1 ] ; then
  100.         # NAME=${1%.*}
  101.         # mkdir $NAME && cd $NAME
  102.         case $1 in
  103.           *.tar.bz2)   tar xvjf $1    ;;
  104.           *.tar.gz)    tar xvzf $1    ;;
  105.           *.tar.xz)    tar xvJf $1    ;;
  106.           *.lzma)      unlzma $1      ;;
  107.           *.bz2)       bunzip2 $1     ;;
  108.           *.rar)       unrar x -ad $1 ;;
  109.           *.gz)        gunzip $1      ;;
  110.           *.tar)       tar xvf $1     ;;
  111.           *.tbz2)      tar xvjf $1    ;;
  112.           *.tgz)       tar xvzf $1    ;;
  113.           *.zip)       unzip $1       ;;
  114.           *.Z)         uncompress $1  ;;
  115.           *.7z)        7z x $1        ;;
  116.           *.xz)        unxz $1        ;;
  117.           *.exe)       cabextract $1  ;;
  118.           *)           echo "extract: '$1' - unknown archive method" ;;
  119.         esac
  120.     else
  121.         echo "$1 - file does not exist"
  122.     fi
  123. fi
  124. }
  125.  
  126.  
  127. myinfo () {
  128.   printf "CPU: "
  129.   cat /proc/cpuinfo | grep "model name" | head -1 | awk '{ for (i = 4; i <= NF; i++) printf "%s ", $i }'
  130.   printf "\n"
  131.  
  132.   cat /etc/issue | awk '{ printf "OS: %s %s %s %s | " , $1 , $2 , $3 , $4 }'
  133.   uname -a | awk '{ printf "Kernel: %s " , $3 }'
  134.   uname -m | awk '{ printf "%s | " , $1 }'
  135.   if ! type "kded4" > /dev/null; then
  136.     echo -n ""
  137.   else
  138.     kded4 --version | grep "KDE Development Platform" | awk '{ printf "KDE: %s", $4 }'
  139.   fi
  140.   printf "\n"
  141.   uptime | awk '{ printf "Uptime: %s %s %s", $3, $4, $5 }' | sed 's/,//g'
  142.   printf "\n"
  143.   cputemp | head -1 | awk '{ printf "%s %s %s\n", $1, $2, $3 }'
  144.   cputemp | tail -1 | awk '{ printf "%s %s %s\n", $1, $2, $3 }'
  145.   #cputemp | awk '{ printf "%s %s", $1 $2 }'
  146. }
  147.  
  148.  
  149. #Use it as dp N, where N is 1, 2 or 3.
  150. dp () {
  151.   if [[ $1 -eq "1" || $# -eq "0" ]]; then
  152.     PS1="\033[01;32m$\033[00m "
  153.   elif [[ $1 -eq "2" ]]; then
  154.     PS1="${debian_chroot:+($debian_chroot)}\w\033[01;32m$\033[00m "
  155.   elif [[ $1 -eq "3" ]]; then
  156.     PS1="\033[01;32m\u@\H:${debian_chroot:+($debian_chroot)}\w\033[01;32m$\033[00m "
  157.   fi
  158.   return;
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement