Home > OS, OS X > bash customizing in OS X Leopard

bash customizing in OS X Leopard

September 27th, 2008 dirk Leave a comment Go to comments

Since I’m using Mac OS X for admin tasks at work I was annoyed about the keymappings and presets in Terminal.app. As bash is the standard shell in Leopard, I missed the settings that I’m accustomed to as a long term Linux user and admin.

If every solution could be so easy. Just create the neccessary config files:

touch ~/.bash_profile

paste the following code in ~/.bash_profile:

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
touch ~/.bashrc

As usual, you can tweak almost all bash settings in your “~/.bashrc”.
Here are some examples:

# Define how Bash prompt looks like:
#
# User @ Host - working dir
export PS1='\u@\h\w: '
 
# Cli Colors
export CLICOLOR=1
# use bold blue for dir’s
export LSCOLORS=Exfxcxdxbxegedabagacad
 
# history handling
#
# Erase duplicates
export HISTCONTROL=erasedups
# resize history size
export HISTSIZE=5000
# append to bash_history if Terminal.app quits
shopt -s histappend
 
alias l='ls -al'

Adapt the keyboard mappings to your needs:

touch ~/.inputrc

The following code shows some example setting for your ~/.inputrc:

# do not bell on tab-completion
set bell-style none
# set bell-style visible
set convert-meta off
set input-meta on
set output-meta on
set show-all-if-ambiguous on
set visible-stats on
set completion-ignore-case On
 
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
Categories: OS, OS X Tags:
  1. No comments yet.
You must be logged in to post a comment.
Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien: