Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've declared an alias in .bashrc file located in my home directory. Export of PS1 environment variable has been added to this file too.

# /etc/skel/.bashrc
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen !

# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!

# Put your fun stuff here.
alias ll='ls -l'
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \$\[\033[00m\] '

However, these changes don't have any effect. I don't have the alias declared in the file after logon. $PS1 isn't affected too. AFAIK user's .bashrc script is sourced by .bash_profile script located in the user's home directory. So I've added the following line to my .bash_profile for testing purposes:

echo hello > ~/test.txt

Here is full content of my .bash_profile file:

# /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
echo hello > ~/test.txt
[[ -f ~/.bashrc ]] && . ~/.bashrc

test.txt doesn't appear in my home directory after logon. It seems that the .bash_profile isn't called during logon.

How to set the system to take user's .bash_profile into account?

share|improve this question
Is your shell a login shell? It means for example logging in from a Linux console (Ctrl+Alt+F1), through ssh: ssh localhost or su -l $USER etc. – pabouk Jul 25 '13 at 22:14
@pabouk I boot my system in runlevel 3 and then start GUI with startx manually if needed. So immediately after boot I definitely have login shell. However, there isn't any sign (alias, environment variable, test.txt file) that my .bash_profile script is executed. – vect Jul 26 '13 at 6:25

Could you try to run bash by hand? Simply


for interactive shell which will use .bashrc file and

bash -l

for login shell to test /etc/profile and ~/.bash_profile files.

Additionally, you can try to trace system calls of the bash process with strace utility and to check wether configuration files where opened at least

strace -f -e open bash
strace -f -e open bash -l
share|improve this answer
up vote 1 down vote accepted

Thank you, dsumsky, for your answer.

Indeed, .bashrc is definitely sourced when I run bash manually. This put in my mind the question "What shell is set as login shell for my user?". It was /bin/sh. The problem has disappeared after I replaced it with /bin/bash despite the fact that /bin/sh symlink is targeted at /bin/bash.

share|improve this answer
When you call bash as sh it runs in Bourne shell compatibility mode and it will not source ~/.bash_profile. It will source ~/.profile at the first place instead. – pabouk Aug 20 '13 at 16:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.