# Right PATH to Linux

## Roles of various config files

### Background

#### Updated $\LaTeX$ version

From this $\TeX$-SE question about tlmgr, we see some advantages of installing $\TeX$Live directly from the official site:

1. avoid errors due to outdated version of $\TeX$Live supplied by the OS’s package manager
2. easier to manage packages with tlmgr.
3. enjoy the newer version of $\TeX$Live not yet available in your current GNU/Linux version.

The installation took about 30 minutes and 5G in the disk. I’ve chosen a local installation as this didn’t require sudo privileges. The whole process went smooth and the system displayed a message about setting

Due to Juno, an IDE for Julia on Atom, I’ve started using Atom for $\LaTeX$ document preparation. I’ve chosen James Yu’s Atom-$\LaTeX$ for the task. Unluckily, I received an error during a compilation because Atom couldn’t detect the locally installed $\TeX$Live and the $PATH in my ZSHRC. ### Problem The problems in the previous section bring us to the classical problem of setting the environment $PATH on GNU/Linux. At first, I thought it was just another easy piece of config work. Either one of the following would do.

1. system-wide:
• edit /etc/environment; or
• create a symbolic link under /usr/bin, or /usr/local/bin, or etc
2. local:
• edit my BASHRC/ZSHRC; or
• create a symbolic link under ~/bin or ~/.local/bin, or etc

However, I struggled with these these for a day without success.

### Discussion

Hours of experiments lead me to this (over-)simplified division of roles of the system’s config files.

Files Scope GUI TTY TERM Roles
/etc/environment system set environment $PATH system-wide ~/.zshrc user set shell $PATH after ~/.zprofile
~/.zprofile user fix session $PATH right after shell login ~/.xprofile user fix session $PATH right after GUI login (XFCE only)
~/.pam_environment user set $PATH after GUI login (special syntax) Remarks: You may replace “Zsh” with “bash” in the above table. When ~/.zprofile (or ~/.bash_profile) is present, the system would read it instead of ~/.profile. • TTY: shell login in /dev/tty{n} • TERM: terminal emulator in GUI The difference between ~/.zshrc and ~/.zprofile is that the later is only read once after login, while the former can be updated by either source ~/.zshrc or starting a new terminal window in GUI. Therefore, the later holds shell varaibles that remain constant throughout the session. ### Solution Here’s how I set the $PATH.

• system-wide installed Julia under /opt
• /etc/environment
• locally installed $\TeX$Live under ~/.local/texlive:
• ~/.pam_environment: I couldn’t find a GNOME counterpart of ~/.xprofile.
• ~/.zshrc: larger coverage than ~/.zprofile, more commonly set.

Since I manage my dotfiles with GNU Stow, after creating a new file, I will stow {folder} to create the corresponding symbolic link(s).