PATH ~/bin under gnome

Marius Gedminas marius at
Wed Nov 22 14:44:55 UTC 2006

On Wed, Nov 22, 2006 at 11:29:12PM +1100, Peter Garrett wrote:
> On Tue, 21 Nov 2006 20:06:59 +0000
> Adam Funk <a24061 at> wrote:
> > Is there an equivalent for XFCE4?  Since I switched to Ubuntu, I've
> > noticed that environment variables that I've always set in ~/.bashrc
> > are not getting passed to applications launched from the GUI, and I'd
> > like to be able to set some of them for all (GUI and console)
> > applications.
> "All programs, or symbolic links to programs, in ~/Desktop/Autostart/ will
> be run by startxfce4 on startup."

Ah, but will shell scripts be *run*, or will they be *sourced*?  If
they're run like ordinary programs, any environment variable
modifications will not affect the parent process, so you get no effect.

There's a nearly universal solution: use ~/.xsession, place your environment
variable modification at the top and exec the appropriate session script
at the end (e.g. exec /usr/bin/gnome-session).  Then choose "custom" in
your login manager.

You can find out the session executable in /usr/share/xsessions/: each
.desktop file corresponds to a session choice (GNOME, KDE, XFCE) and
has an Exec= line specifying the command name.

So a sample ~/.xsession script could look like:

  export EDITOR=vim
  export EMAIL=whatever at
  exec /usr/bin/gnome-session

The downside to this approach is that you cannot choose different
sessions in your display manager's menu and expect your environment
variable settings to appear in each of them.

All this applies if you want to modify the environment of a single user.
If you want to make global environment changes, editing /etc/environment
or /etc/profile is probably the best way.  Note that /etc/environment is
not a shell script, and I wouldn't expect PATH="$HOME/bin:$PATH" to work

Marius Gedminas
This sentence contradicts itself -- no actually it doesn't.
                -- Douglas Hofstadter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the ubuntu-users mailing list