Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 have the following in my .bashrc file...

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# multi-monitor configuration
xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output DP1 --off --output VGA1 --mode 1600x900 --pos 1920x0 --rotate normal

When I login, my monitors are mirrored and are at a bad resolution, making me believe this did not run. However, the first time I open a terminal after logging in, my monitors adjust the proper resolution and extend properly.

Why does this .bashrc file seem to be running only after I open a terminal? I was under the impression it runs when I login. How can I get it to do so?

share|improve this question
up vote 5 down vote accepted

.bashrc (as it name may suggest) is only executed on startup of a bash shell.

You have to edit ~/.profile to apply changes to your graphical session. Note that this file is intended for setting environment variables and such. You'd better create a startup script to accomplish this task.

share|improve this answer
Heh. I should have assumed that from the name. Got it fixed now. Thanks! – TaylorOtwell Jul 7 '11 at 17:46
Ya should mark Lekensteyn's post as the answer then – Thomas Ward Jul 7 '11 at 17:57

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.