[Trisquel-users] how do I set a global PATH?

Michał Masłowski mtjm at mtjm.eu
Mon Sep 24 18:22:45 CEST 2012

> PATH is defined on several levels. "Child" processes inherit PATH from
> their "parents".

PATH is an environment variable.  Each process has its own environment
which is copied into its children.

> I suppose:
>  ~/.bash* belongs to a child process of the one defined in
> /etc/profile.d.
> the /etc/profile.d belongs to a child of /etc/environment .
> Is this correct?

Shell processes run commands from various initialization files, bash
uses /etc/profile, ~/.bash_profile, ~/.bashrc and others depending on
how it's run (the manual explains this in detail).  /etc/environment has
other uses.

Most processes that a user runs are started (directly or indirectly)
From a shell.

> I like the solution with the extra fil in /etc/profile.d, but I have
> some questions first.
> 1. on what level is PATH defined here?

These files are sourced from /etc/profile which is sourced from login
shells when they start ("source" is a shell command for running commands
From a file in the same process; shell scripts are typically run in
separate processes).

> 2. can the file have any name?

It must end with ".sh".

> 3. what should be in the file? Just the same as I have added to by
> ~/.bashrc? (See above)

E.g. this line:

export PATH=$PATH:/usr/local/texlive/2012/bin/i386-linux

(or change PATH and export it on a separate line; export is needed since
otherwise it will be only a shell variable that isn't available to other
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://listas.trisquel.info/pipermail/trisquel-users/attachments/20120924/77513940/attachment.pgp>

More information about the Trisquel-users mailing list