Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.37 KB | None | 0 0
  1. #
  2. # ~/.bashrc
  3. #
  4. # If not running interactively, don't do anything
  5. #command archey
  6.  
  7. [[ $- != *i* ]] && return
  8. alias ls='ls --color=auto'
  9. alias more='less'
  10. alias df='df -h'
  11. alias du='du -c -h'
  12. alias mkdir='mkdir -p -v'
  13. alias nano='nano -w'
  14. alias ping='ping -c 5'
  15. alias ..='cd ..'
  16. alias diff='colordiff'
  17. # new commands
  18. alias da='date "+%A, %B %d, %Y [%T]"'
  19. alias du1='du --max-depth=1'
  20. alias hist='history | grep $1'      # requires an argument
  21. alias openports='netstat --all --numeric --programs --inet --inet6'
  22. alias pg='ps -Af | grep $1'         # requires an argument (note: /usr/bin/pg is installed by the util-linux package; maybe a different alias name should be used)
  23. alias rdp=' xfreerdp -a 16 -u u310 -g 1366x768 -x l --plugin cliprdr --plugin rdpdr --data disk:skynet:/home/captain/ -- 192.168.0.95
  24. '
  25. # privileged access
  26. if [ $UID -ne 0 ]; then
  27.     alias sudo='sudo '
  28.     alias scat='sudo cat'
  29.     alias svim='sudo vim'
  30.     alias root='sudo su'
  31.     alias reboot='sudo reboot'
  32.     alias halt='sudo halt'
  33.     alias update='sudo pacman -Su'
  34.     alias netcfg='sudo netcfg2'
  35. fi
  36.  
  37. # ls
  38. alias ls='ls -hF --color=auto'
  39. alias lr='ls -R'                    # recursive ls
  40. alias ll='ls -l'
  41. alias la='ll -A'
  42. alias lx='ll -BX'                   # sort by extension
  43. alias lz='ll -rS'                   # sort by size
  44. alias lt='ll -rt'                   # sort by date
  45. alias lm='la | more'
  46. alias arduino='bash ~/hard/project/arduino-1.0.4/arduino'
  47. # safety features
  48. alias cp='cp -i'
  49. alias mv='mv -i'
  50. alias rm='rm -I'                    # 'rm -i' prompts for every file
  51. alias ln='ln -i'
  52. alias chown='chown --preserve-root'
  53. alias chmod='chmod --preserve-root'
  54. alias chgrp='chgrp --preserve-root'
  55. alias camera="vlc -I dummy v4l2:///dev/video0 --sout '#transcode{vcodec=mp4v,vb=400,width=640,height=480,fps=15}:standard{access=http,mux=ogg,dst=192.168.0.31:8080}'"
  56. alias ipmi="~/hard/нужное/IPMIView/IPMIView20"
  57. alias size-hex="find . -name 'firmware.hex' -print -exec size {} \;"
  58. alias mnt='encfs ~/Документы/top_privat ~/Документы/mnt'
  59. alias umnt='fusermount -u ~/Документы/mnt'
  60.  
  61. PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\] '
  62. alias wakeup='wakeonlan A8:20:66:20:42:DB'
  63.  
  64. if [[ $- != *i* ]] ; then
  65.     # Shell is non-interactive.  Be done now!
  66.     return
  67. fi
  68.  
  69. # Bash won't get SIGWINCH if another process is in the foreground.
  70. # Enable checkwinsize so that bash will check the terminal size when
  71. # it regains control.  #65623
  72. # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
  73. shopt -s checkwinsize
  74.  
  75. # Enable history appending instead of overwriting.  #139609
  76. shopt -s histappend
  77.  
  78. # Change the window title of X terminals
  79. case ${TERM} in
  80.     xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
  81.         PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
  82.         ;;
  83.     screen)
  84.         PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
  85.         ;;
  86. esac
  87.  
  88. use_color=false
  89.  
  90. # Set colorful PS1 only on colorful terminals.
  91. # dircolors --print-database uses its own built-in database
  92. # instead of using /etc/DIR_COLORS.  Try to use the external file
  93. # first to take advantage of user additions.  Use internal bash
  94. # globbing instead of external grep binary.
  95. safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
  96. match_lhs=""
  97. [[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
  98. [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
  99. [[ -z ${match_lhs}    ]] \
  100.     && type -P dircolors >/dev/null \
  101.     && match_lhs=$(dircolors --print-database)
  102. [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
  103.  
  104. if ${use_color} ; then
  105.     # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
  106.     if type -P dircolors >/dev/null ; then
  107.         if [[ -f ~/.dir_colors ]] ; then
  108.             eval $(dircolors -b ~/.dir_colors)
  109.         elif [[ -f /etc/DIR_COLORS ]] ; then
  110.             eval $(dircolors -b /etc/DIR_COLORS)
  111.         fi
  112.     fi
  113.  
  114.     if [[ ${EUID} == 0 ]] ; then
  115.         PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
  116.     else
  117.         PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
  118.     fi
  119.  
  120.     alias ls='ls --color=auto'
  121.     alias grep='grep --colour=auto'
  122. else
  123.     if [[ ${EUID} == 0 ]] ; then
  124.         # show root@ when we don't have colors
  125.         PS1='\u@\h \W \$ '
  126.     else
  127.         PS1='\u@\h \w \$ '
  128.     fi
  129. fi
  130.  
  131. # Try to keep environment pollution down, EPA loves us.
  132. unset use_color safe_term match_lhs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement