.bashrc is the primary configuration file for the bash shell.
Questions tagged [bashrc]
442 questions
1413
votes
12 answers
How to correctly add a path to PATH?
I'm wondering where a new path has to be added to the PATH environment variable. I know this can be accomplished by editing .bashrc (for example), but it's not clear how to do this. This way: export PATH=~/opt/bin:$PATH or this? export…
Paolo
- 17,985
357
votes
4 answers
283
votes
3 answers
What is the purpose of .bashrc and how does it work?
I found the .bashrc file and I want to know the purpose/function of it. Also how and when is it used?
Pandya
- 26,011
107
votes
8 answers
Is it possible to check where an alias was defined?
An alias, such as ll is defined with the alias command. I can check the command with things like type ll which prints ll is aliased to `ls -l --color=auto' or command -v ll which prints alias ll='ls -l --color=auto' or alias ll which also prints…
polemon
- 12,071
80
votes
3 answers
Refresh aliases and functions after defining new aliases and functions?
When I define a new alias in .bash_aliases file or a new function in .bashrc file, is there some refresh command to be able immediately use the new aliases or functions without closing the terminal (in my case xfce4-terminal with a few tabs open,…
xralf
- 14,393
- 32
- 119
- 165
77
votes
3 answers
What is the difference between ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc ...?
Answers to the questions on SO and askubuntu , along with poking through (and reading headers of) $HOME and /etc/ , indicate a number of files that can be used to set environment variables, including: ~/.profile ~/.bashrc ~/.bash_profile ~/.gnomerc…
Abe
- 1,691
- 2
- 13
- 8
77
votes
3 answers
Using export in .bashrc
I have noticed in my .bashrc that some lines have export in front of them, such as export HISTTIMEFORMAT="%b-%d %H:%M " ... export MYSQL_HISTFILE="/root/.mysql_history" whereas others don't, such as HISTSIZE=100000 I am wondering if, first, this is…
Martin Vegter
- 1,198
53
votes
4 answers
How can I create a local function in my bashrc?
My .bashrc had some code that was repetitive so I used a function to simplify it do_stuff() { local version=$1 export FOO_${version}_X="17" export FOO_${version}_Y="42" } do_stuff '5.1' do_stuff '5.2' However, now when I use my shell the "do_stuff"…
hugomg
- 6,145
49
votes
1 answer
What's the difference between .bashrc and .inputrc
I am new to the unix system, and find it interesting to create customized functions and configurations in the setting files like .bashrc and .inputrc . However, I don't understand the differences between the two. For example, when I created alias, I…
Counter10000
- 605
47
votes
5 answers
How do I get rid of Cygwin's /cygdrive prefix in all paths?
I'm switching to Cygwin from the bash shell that ships with Git for Windows, and encountering a strange problem. Someone thought it would be a good idea to add /cygdrive/ to all paths, while I think it's a horribly ugly idea. I've been able to…
iconoclast
- 9,532
42
votes
3 answers
sudo command doesn't source /root/.bashrc
I have added a custom path to PATH variable in my /root/.bashrc file When i do sudo su; echo $PATH , it shows the entry, '/path/to/custom/bins'. But i do sudo sh -c 'echo $PATH' , it shows,…
user93868
40
votes
4 answers
How can I find a rogue alias declaration?
I'm trying to find where a specific alias has been declared. I've searched all the usual places I know to look for aliases: ~/.bashrc ~/.bash_profile /etc/bashrc /etc/profile With no luck. I know it's an alias because when I do which COMMAND , I…
user3520
38
votes
4 answers
Global bash_profile
I realize there are /etc/profile and /etc/bashrc files for setting global environment variables and maybe I'm just misunderstanding their purposes, but... Is there a global bash_profile file? I'm using Mac OS X
user23312
35
votes
2 answers
Bash doesn't read .bashrc unless manually started
bash won't source .bashrc from an interactive terminal unless I manually run bash from a terminal: $ bash or manually source it: $ source ./.bashrc or running: $ st -e bash Here's some useful output I hope: $ echo $TERM st-256color $ echo $SHELL…
haste
- 485
34
votes
8 answers
Doing simple math on the command line using bash functions: $1 divided by $2 (using bc perhaps)
Sometimes I need to divide one number by another. It would be great if I could just define a bash function for this. So far, I am forced to use expressions like echo 'scale=25;65320/670' | bc but it would be great if I could define a .bashrc…
ixtmixilix
- 13,660