How to automatically execute a shell script when logging into Ubuntu

Posted by Mike Rowave on Super User See other posts from Super User or by Mike Rowave
Published on 2011-06-20T00:13:34Z Indexed on 2012/06/28 21:19 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

How do I get a script to execute automatically when I log in? Not when the machine starts up, and not for all users, but only when I (or any specific user with the script) login via the GNOME UI.

From reading elsewhere I thought it was .bash_profile in my home directory, but for me it has no effect. When I manually execute it in a terminal window by typing ~/.bash_profile it works, but it won't run automatically when I log in.

I'm running Ubuntu 11.04. The file permission on my .bash_profile is -rwx------. No .bash_profile existed in my home directory before I created it today.

I seem to remember older versions of Linux having a .profile file for each user, but that doesn't work either.

How is it done? Do I need to configure something else to get the .bash_profile to work? Or does the per-user login script need to be in some other file?

© Super User or respective owner

Related posts about bash

Related posts about gnome