Questions tagged [bashrc]

bashrc is one of the scripts the Bash shell reads as .bashrc and executes when started as an interactive (but not login) shell.

When the Bash shell is started as an interactive (but not login) shell, the .bashrc script (if it exists) is read and executed.

The --norc option can prevent this, and the --rcfile <file> option will cause Bash to read and execute <file> instead of .bashrc.

300 questions
572
votes
6 answers

Difference between .bashrc and .bash_profile?

What's the difference between .bashrc and .bash_profile and which one should I use?
cfischer
  • 9,163
242
votes
3 answers

What does the 'rc' in `.bashrc`, etc. mean?

Well, this is embarrassing. I feel like I just realised I don't know a loyal colleague's name after working with them for 10 years. "Hey, er... *cough!*, thanks for that great job you did on setting my aliases this morning..." What do the letters rc…
155
votes
4 answers

Bash if on single line

I would like to know how can I write if conditions inside a bash script on a single line. For example, how can I write this on a single line, and then put another one just like it on the next? if [ -f "/usr/bin/wine" ]; then export…
DELETED
  • 1,701
150
votes
8 answers

Show only current directory name (not full path) on bash prompt

The way my bash prompt is currently configured, it shows the whole path to the current directory. This is annoying when I'm deep inside a directory tree, as the prompt becomes so long that every command wraps into the next line. How do I make it…
agentofuser
  • 7,677
122
votes
6 answers

How do I modify my Git Bash profile in Windows?

I'm using Git Bash on Windows 7 and would like to set up Bash profile aliases such as alias gs='git status' to make my life easier. How can I do this?
Brian
  • 1,441
  • 3
  • 13
  • 17
118
votes
3 answers

What is the .bashrc file?

Unix shells when starting read the .bashrc file and execute commands written in it. What is this file and what does it execute?
pineapple
  • 2,114
113
votes
8 answers

Mac OS X .bashrc not working

I have a one-line .bashrc file in my home directory: alias countlines='find . -type f -print0 | xargs -0 cat | wc -l' But it is not creating the alias. Why might that be?
104
votes
12 answers

Is there Windows equivalent to the .bashrc file in Linux?

Just discovered doskey emacs=emacs -nw $*, but without something like .bashrc, I'll have to type that every time I start a shell, right?
herrturtur
67
votes
3 answers

iTerm/zsh not reading .bashrc OR .bash_profile

In ~/.bash_profile I have : if [ -f ~/.bashrc ]; then source ~/.bashrc fi In ~/.bashrc I have some aliases When I load a new iTerm window, my aliases do not work. If I source ~/.bashrc they work. If I source ~.bash_profile they work. Isn't at…
Damon
  • 2,789
  • 6
  • 28
  • 29
51
votes
7 answers

Where's .bashrc for root?

I know it's not best practice, but on my dev system I login as root. What's the equivalent of the .bashrc file so I can alias some functions? I've found the /etc/bash.bashrc & /etc/bash.bashrc.local but I'm not sure where to plop my commands.…
mbb
  • 2,546
  • 7
  • 27
  • 39
50
votes
3 answers

Environment variables in bash_profile or bashrc?

I have found this question [blog]: Difference between .bashrc and .bash_profile very useful but after seeing the most voted answer (very good by the way) I have further questions. Towards the end of the most voted, correct answer I see the statement…
49
votes
7 answers

MinGW Bash profile

I use MinGW on Windows 7. I have a .bashrc with some aliases in it. The file is in my home folder which is where MinGW starts me in, so it also believes that the folder is my home folder. It does not load the contents of the folder automatically. I…
KurToMe
  • 493
40
votes
2 answers

Linux: coloring bash prompt will break carriage return

When I try to colorize the bash prompt like this: export PS1="\e[0;31m[\u@\h \W]\$ \e[m " it breaks the carriage return (instead of going to a new line when line is full, it starts in the same line and erases the input text). If I remove the color…
Abonec
  • 502
38
votes
2 answers

Open gnome terminal programmatically and execute commands after bashrc was executed

For starting my dev environment I wrote a little script. One part is to open a gnome terminal with several tabs where automatically some commands should be executed. Some of those commands depend on an already executed .bashrc. But when…
medihack
  • 940
31
votes
2 answers

Bash not loading '.profile' in new session on Linux

I'm setting up a new Linux machine I got from our IT dept, and noticed .profile is not loaded when I start a new terminal session. The current shell is Bash, though I changed it from the default sh it came with. How do I make it load .profile on…
sa125
  • 1,036
1
2 3
19 20