微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

.bashrc配置文件

分享一下作者的.bashrc文件

  1 # ~/.bashrc: executed by bash(1) for non-login shells.
  2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3 # for examples
  4 
  5 # If not running interactively, don't do anything
  6 [ -z "$PS1" ] && return
  7 
  8 # don't put duplicate lines or lines starting with space in the history.
  9 # See bash(1) for more options
 10 HISTCONTROL=ignoreboth
 11 
 12 # append to the history file, don't overwrite it
 13 shopt -s histappend
 14 
 15 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
 16 HISTSIZE=1000
 17 HISTFILESIZE=2000
 18 
 19 # check the window size after each command and, if necessary,
 20 # update the values of LInes and COLUMNS.
 21 shopt -s checkwinsize
 22 
 23 # If set, the pattern "**" used in a pathname expansion context will
 24 # match all files and zero or more directories and subdirectories.
 25 #shopt -s globstar
 26 
 27 # make less more friendly for non-text input files, see lesspipe(1)
 28 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
 29 
 30 # set variable identifying the chroot you work in (used in the prompt below)
 31 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
 32     debian_chroot=$(cat /etc/debian_chroot)
 33 fi
 34 
 35 # set a fancy prompt (non-color, unless we kNow we "want" color)
 36 case "$TERM" in
 37     xterm-color) color_prompt=yes;;
 38 esac
 39 
 40 # uncomment for a colored prompt, if the terminal has the capability; turned
 41 # off by default to not distract the user: the focus in a terminal window
 42 # should be on the output of commands, not on the prompt
 43 #force_color_prompt=yes
 44 
 45 if [ -n "$force_color_prompt" ]; then
 46     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
 47     # We have color support; assume it's compliant with Ecma-48
 48     # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
 49     # a case would tend to support setf rather than setaf.)
 50     color_prompt=yes
 51     else
 52     color_prompt=
 53     fi
 54 fi
 55 
 56 if [ "$color_prompt" = yes ]; then
 57     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 58 else
 59     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 60 fi
 61 unset color_prompt force_color_prompt
 62 
 63 # If this is an xterm set the title to user@host:dir
 64 case "$TERM" in
 65 xterm*|rxvt*)
 66     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
 67     ;;
 68 *)
 69     ;;
 70 esac
 71 
 72 # enable color support of ls and also add handy aliases
 73 if [ -x /usr/bin/dircolors ]; then
 74     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
 75     alias ls='ls --color=auto'
 76     #alias dir='dir --color=auto'
 77     #alias vdir='vdir --color=auto'
 78 
 79     alias grep='grep --color=auto'
 80     alias fgrep='fgrep --color=auto'
 81     alias egrep='egrep --color=auto'
 82 fi
 83 
 84 # some more ls aliases
 85 alias ll='ls -alF'
 86 alias la='ls -A'
 87 alias l='ls -CF'
 88 
 89 # Add an "alert" alias for long running commands.  Use like so:
 90 #   sleep 10; alert
 91 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$//'\'')"'
 92 
 93 # Alias deFinitions.
 94 # You may want to put all your additions into a separate file like
 95 # ~/.bash_aliases, instead of adding them here directly.
 96 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
 97 
 98 if [ -f ~/.bash_aliases ]; then
 99     . ~/.bash_aliases
100 fi
101 
102 # enable programmable completion features (you don't need to enable
103 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
104 # sources /etc/bash.bashrc).
105 if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
106     . /etc/bash_completion
107 fi

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐