just capturing a whole bunch of notes around making the bash shell more practical, esp. when I end up in distributions which give it to you raw…
Files
- /etc/profile (global)
- /etc/bashrc (global)
- ~/.bash_profile
- ~/.bashrc
- ~/.bash_logout
Prompts
setup prompt to display date/time, hostname and current directory:
$ PS1="[\d \t \u@\h:\w ] $ "
eg of clever script for bashrc
# If id command returns zero, you’ve root access. if [ $(id -u) -eq 0 ]; then # you are root, set red colour prompt PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]" else # normal PS1="[\\u@\\h:\\w] $" fi
History
HISIZE controls the number of commands to remember in the history command.
HISTFILE defines the file in which all commands will be logged to. Normally the value for this variable is set to ~/.bash_history (or /dev/null on minimalistic distros)
HISTFILESIZE defines the maximum number of commands ~/.bash_history, or whatever value you assign to HISTFILE, can hold.
safety aliases
alias rm=’rm -i’ alias mv=’mv -i’ alias cp=’cp -i’
convenience aliases
alias ls=’ls -aF —color’
alias sl=’ls -aF —color’
(or ls --color=tty --classify etc)
Job notifications
[1]1+ Done updatedb
If you want this message to pop up automatically without you having to hit the ENTER key, then you have to set the notify variable in your /etc/profile or your ~/.bash_profile. This can be done by adding the following entry into your /etc/profile or ~/.bash_profile:
set -o notify
loads more http://www.gilesorr.com/bashprompt/howto/
|