User:Mattx86/Bash Profile: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Here's the <code>~/.bash_profile</code> that I use: | Here's the <code>~/.bash_profile</code> that I use: | ||
<pre>alias | <pre> | ||
alias nano='nano -c' | # Aliases | ||
alias sudo='sudo ' # sudo: make aliases work | |||
alias nano='nano -wcAiLS' # nano: -w: don't wrap long lines | |||
# -c: constantly show cursor position | |||
# -A: enable smart home key | |||
# -i: automatically indent new lines | |||
# -L: don't add newlines to the ends of files | |||
# -S: scroll by line instead of half-screen | |||
alias apk='apk --progress' # apk: show progress bar | |||
# Shell Options | |||
shopt -s checkwinsize | |||
# Color Definitions for .bashrc | |||
COL_YEL="\[\e[1;33m\]" | COL_YEL="\[\e[1;33m\]" | ||
COL_GRA="\[\e[0;37m\]" | COL_GRA="\[\e[0;37m\]" | ||
Line 10: | Line 22: | ||
COL_RED="\[\e[1;31m\]" | COL_RED="\[\e[1;31m\]" | ||
# Bash Prompt | |||
if test "$UID" -eq 0 ; then | if test "$UID" -eq 0 ; then | ||
_COL_USER=$COL_RED | |||
_p=" #" | |||
else | else | ||
_COL_USER=$COL_GRE | |||
_p=">" | |||
fi | fi | ||
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]" | COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]" | ||
case $TERM in | case $TERM in | ||
*term | rxvt | screen ) | |||
PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;; | |||
linux ) | |||
PS1="${COLORIZED_PROMPT}" ;; | |||
* ) | |||
PS1="\u@\h:\w${_p} " ;; | |||
esac | esac | ||
</pre> | |||
Be sure to symlink <code>.bashrc</code> to <code>.bash_profile</code>. | {{Tip|Be sure to symlink <code>.bashrc</code> to <code>.bash_profile</code>.}} |
Latest revision as of 12:27, 26 January 2011
Here's the ~/.bash_profile
that I use:
# Aliases alias sudo='sudo ' # sudo: make aliases work alias nano='nano -wcAiLS' # nano: -w: don't wrap long lines # -c: constantly show cursor position # -A: enable smart home key # -i: automatically indent new lines # -L: don't add newlines to the ends of files # -S: scroll by line instead of half-screen alias apk='apk --progress' # apk: show progress bar # Shell Options shopt -s checkwinsize # Color Definitions for .bashrc COL_YEL="\[\e[1;33m\]" COL_GRA="\[\e[0;37m\]" COL_WHI="\[\e[1;37m\]" COL_GRE="\[\e[1;32m\]" COL_RED="\[\e[1;31m\]" # Bash Prompt if test "$UID" -eq 0 ; then _COL_USER=$COL_RED _p=" #" else _COL_USER=$COL_GRE _p=">" fi COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]" case $TERM in *term | rxvt | screen ) PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;; linux ) PS1="${COLORIZED_PROMPT}" ;; * ) PS1="\u@\h:\w${_p} " ;; esac
Tip: Be sure to symlink
.bashrc
to .bash_profile
.