Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'bash, /etc/profile, /etc/bashrc, and X11' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
bash, /etc/profile, /etc/bashrc, and X11
Authored by: kholburn on Aug 28, '03 11:37:58PM

First of all the best way to add this to /etc/profile is
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

I have until very recently used tcsh because it has these 2 features that bash didn't used to have. History search and command completion. The latest version has these so here's how to get them:

Add these 2 lines to
/etc/inputrc

control-p: history-search-backward
control-n: history-search-forward

If you are in a bash shell already you will need to run:
bind -f /etc/inputrc
otherwise /etc/inputrc should be loaded on login.

To use this: type the first few letters of a command then control-p and control-n while cycle through all the commands in your history that start with those letters. Very useful.

Also it is worth finding a good copy of the bash completions (bash_completion) put it at /etc/bash_completion

and add to /etc/bashrc

if [ -r /etc/bash_completion ]; then
. /etc/bash_completion
fi

I'm not sure where to find a copy of bash_completion. It is probably linux oriented (some of the options maybe slightly different) but it's a great start.

Here's a copy of my /etc/bashrc:

--------------------------------------------------
if [ "$PS1" ]; then
PS1='\e[1m\u@\H:\w \n\$\e[0m '
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

export HISTSIZE=10000
export HISTCONTROL=ignoredups

alias ls='ls --color=auto -axF'
alias l='ls -al'
fi
--------------------------------------------------



[ Reply to This | # ]