On my OS X system, when I use a subshell (for example with screen), the settings in my .bash_profile are inherited, but on Ubuntu, they are not, and in order to get the same behavior I have on OS X I have to add  source ~/.bash_profile   to the start of my .bashrc.  Does Ubuntu (Linux) handle the relationship between .bash_profile and .bashrc and their use in subshells differently from OS X (BSD)? Is there an Ubuntu setting that makes it behave like OS X in this regard so that I can avoid the above line?
41843
Problem  I have an Ubuntu 11.04 Virtual Machine and I wanted to set up my Java development environment. I did as follows   sudo apt-get install openjdk-6-jdk Added the following entries to ~/.bash_profile  export JAVA_HOME=/usr/lib/jvm/java-6-openjdk  export PATH=$PATH:$JAVA_HOME/bin  Save the changes and exit Open up a terminal again and typed the following  echo $JAVA_HOME   (blank) echo $PATH        (displayed, but not the JAVA_HOME value)  Nothing happened, like if the export of JAVA_HOME and it's addition to the PATH were never done.   Solution  I had to go to ~/.bashrc and add the following entry towards the end of file  #Source bash_profile to set JAVA_HOME and add it to the PATH because for some reason is not being picked up . ~/.bash_profile   Questions   Why did I have to do that? I thought bash_profile, bash_login or profile in absence of those two get executed first before bashrc.  Was in this case my terminal a non-login shell? If so, why when doing su after the terminal and putting the password it did not execute profile where I had also set the exports mentioned above?
23506
I have a script in my .bash_profile that prompts for X sessions to boot.  When I launch tmux, I get this prompt that I had only intended for the TTY login.  Is there something I can put in .bash_profile that will simply run bash if it is part of tmux?  That is, can I check with bash if .bash_profile is being read within tmux?
40933
I've recently installed  on my Mac and it's complaining that /usr/bin occurs before /usr/local/bin in my $PATH variable, meaning that system-provided programs will be used instead of those installed with Homebrew.  My .bashrc is configured in a set of separate files, as per this . This means that ~/.bash_profile looks like this:  if [ -f ~/.bashrc ]; then   source ~/.bashrc fi   ~/.bashrc looks like this:  source ~/bin/dotfiles/bashrc   and ~/bin/dotfiles/bashrc looks like this:  . ~/bin/dotfiles/bash/env . ~/bin/dotfiles/bash/config . ~/bin/dotfiles/bash/aliases   ~/bin/dotfiles/bash/env, which is where I set my $PATH variable, looks like this:  export EDITOR="kom" export PATH=some/path/at/start:usr/local/bin:/Users/jim/pear/bin:~/bin:/Users/jim/.gem/ruby/1.8/bin:/Users/jim/bin/bashscripts:some/path/at/end:$PATH   I've added some/path/at/start and some/path/at/end for debugging purposes, since when I try echo $PATH I get this:  /opt/local/bin:/opt/local/sbin:/Users/jim/bin:/opt/local/bin:/opt/local/sbin:some/path/at/start:usr/local/bin:/Users/jim/pear/bin:/Users/jim/bin:/Users/jim/.gem/ruby/1.8/bin:/Users/jim/bin/bashscripts:some/path/at/end:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin  That is, there's a load of other stuff being loaded into the $PATH variable that I can't control in the configuration I've outlined above. Any ideas as to where this stuff is loaded from, so that I can go about changing it and moving /usr/local/bin before /usr/bin?
44920
What are the fundamental differences between the mainstream *NIX shells and what scenarios might prompt you to use one over the other?  I understand that some of it probably comes down to user preference but I've only ever used Bash and I'm interested to hear where another shell might be useful. Also, is there an impact on user-written shell scripts when running under one shell or another or is it simply a matter of changing the shell at the top of the file?  My instinct says it's not that easy.
28646
I've read in a couple of places that the PATH is set in /etc/profile or the .profile file that's in the home dir.  Are these the only places that the path is set in? I want a better understanding of it.  In the /etc/profile file, as the following comment says "system-wide .profile file for the Bourne shell". Does that mean that profile files are the main configuration files for bash?  In that file I don't see the PATH var being set at all. In the .profile file in the home directory there's this line:  PATH="$HOME/bin:$PATH"   That's resetting PATH by the looks because it's concatenating the already set $PATH string with $HOME/bin: right? But if etc/profile and ~/.profile are the only files setting PATH where is $PATH coming from in that line of code if it's not defined in /etc/profile?  Can someone experienced please give a broad and detailed explanation of the PATH variable? Thanks!
33852
Several files in my home directory have been disappearing. E.g. .bashrc, .bash_profile, authorized_keys and now .profile.  Regardless of how this happened, I would like to restore the original pristine .profile file. If I create a new user on my system one is created. Where can I find this .profile contents from a fresh, untouched install?
94744
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 get:  alias COMMAND='/path/to/command'     /path/to/command   Is there a way to find what file declares an alias only knowing the alias name?
43537
Just installed Ubuntu 14.04.1 LTS.  According to .profile,  # ~/.profile: executed by the command interpreter for login shells.  # This file is not read by bash, if ~/.bash_profile or ~/.bash_login exists.   There is no ~/.bash_profile or ~/.bash_login.  It does not seem to source .profile when opening a terminal.   Why doesn't it source .profile when opening a terminal? Why is .profile there if it is not sourced? How do I know/control what is sourced when a new terminal is opened? When a new terminal is opened, does it do a "login"? Where is a good place to add $HOME/bin to my path? .bashrc? Will that cause a problem because .profile has the same code?
33257
I am using my school's computers and would like to use zsh instead of bash. I'd like to make it the default shell, but I cannot run a command such as $ chsh -s $(which zsh) because I don't have admin privileges.   Is there a way I can put something in my .bashrc or something that automatically calls zsh when it opens as a workaround?   To clarify, zsh is already installed.
40465
In shell scripts one specifies language interpreter on shebang(#!) line. As far as I know, it is recommended to use #!/usr/bin/env bash because env is always located in /usr/bin directory while location of bash may vary from system to system. However, are there any technical differences if bash is started directly with /bin/bash or through env utility? In addition, am I correct that if I do not specify any variables for env, the bash is started in unmodified environment?
34068
I want to put new aliases to my .bash_profile file, but I cannot find this file. Where is it supposed to be?
75991
What is the proper way to modify environment variables like PATH in OS&nbsp;X?  I've looked on Google a little bit and found three different files to edit:   /etc/paths ~/.profile ~/.tcshrc   I don't even have some of these files, and I'm pretty sure that .tcshrc is wrong, since OS&nbsp;X uses bash now. Where are these variables, especially PATH, defined?  I'm running  (Leopard).
849
I have a Linux instance that I set up some time ago.  When I fire it up and log in as root there are some environment variables that I set up but I can't remember or find where they came from.     I've checked ~/.bash_profile, /etc/.bash_rc, and all the startup scripts.  I've run find and grep to no avail.   I feel like I must be forgetting to look in some place obvious. Is there a trick for figuring this out?
46709
On Ubuntu 10.4 I have edited the /etc/bash.bashrc file to set some variables like the command history size (HISTSIZE=5000), however if I create a new users Ubuntu by default gives them a .bashrc file in their home directory with this set as HISTSIZE=1000 which is overriding mine. How can I change the default .bashrc file that is created?
101171
I can't find .bash_profile in Ubuntu 14.04 in my /home/user directory. I used the ls -a command to see the .bash_profile, but there isn't such a file.
43909
I found a lot of people figuring out why instruction similar to this :   Put X to your ~/.bashrc and you can do Y    don't work.  It always turns out that Mac OS X's bash's startup files (or Mac's Bash itself) doesn't source ~/.bashrc file, either in the login shell, or in a shell spawned from window system - like Terminal app in Mac OS X)  Why is this, when all other Unix-like systems with Bash I've worked with before have done this?  PS:  I found what Bash itself says about startup files (which could be helpful) :     When Bash is invoked as an interactive login shell, or as a   non-interactive shell with the --login option, it first reads and   executes commands from the file /etc/profile, if that file exists.   After reading that file, it looks for ~/.bash_profile, ~/.bash_login,   and ~/.profile, in that order, and reads and executes commands from   the first one that exists and is readable. The --noprofile option may   be used when the shell is started to inhibit this behavior.   Source :
76072
In my terminal prompt definition in my .bashrc file, among other things, I have this snippet of code:  ${debian_chroot:+($debian_chroot)}   What does this do, and do I need it?