1

I'm using the latest Mint (21.1, 64bit AMD).

Apologies, this is probably more of a Stupor-user question than a Superuser one, but with much web-based searching I have come up with a plethora of possible answers. None of those are clear enough to work (yet), and many are simply not usable in Mint (e.g., Mint doesn't accept 'sudo su' versions of commands...and many more quirky things). And, I cannot locate the mysterious /.profile which supposedly holds the environment variables.

I've recently installed a large software package (TeXLive) and I need to change the $PATH permanently. The $PATH is causing excessive problems with finding and installing updates to the TeXLive Installation. I have been able to temporarily change $PATH using the 'export' command but ----- as you Superusers will all know (!) ---- if you close the terminal window or shut down the computer, those export-enacted changes are lost (i.e, PATH reverts to the original PATH).

So there are 2 questions:

  1. How do I permanently update environment variables such as $PATH (concise monosyllabic answer, please!)
  2. Is there a cross reference between Mint versions of terminal commands, and the other Linux commands that I've discovered splattered across the Internet that do NOT work within Mint (a sort of table that says "if you're supposed to use command X, then in Mint you must employ the command Y")? If answers require further information on file structure or file contents, please ask and I will supply ASAP.

2 Answers 2

0

Do...

$ man bash

... type / then .bashrc, and hit Enter,
then hit n twice and you will see:

When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.

So, simply use any text editor (e.g. nano) and put your PATH change in e.g. ~/.bashrc
(= $HOME/.bashrc), and it will be executed and available in any bash shell you open.

To get to the headline, direct jump:
man bash Enter / ^INVOCATION Enter

q to quit the reader (= the less command)

0

While Hannu's answer is correct for terminal-based programs (as long as you are using bash as your shell), it does not work for most graphical programs.

Most answers probably are reffering to ~/.profile which is /home/YOURUSERNAME/.profile, which is the correct place to make an env change permanent for your user, as this file gets loaded when you log in.

If you want to make changes to all users environment your are searching for /etc/profile.

In both cases just add export PATH="$PATH:/your/custom/path/here" to the end of the file. (You need root permissions to modify /etc/profile)

4
  • Also do you got any specific command that does not work in Linux Mint, but that does work on e.g. Ubuntu? There should not be any fundamentally different things.
    – Malik
    Feb 21, 2023 at 11:33
  • Malik: apologies, did not mean to ignore or slight you. And, perhaps I should have edited and elaborated my question rather than posing another version of it -- it seems that I didn't pose it correctly the first time. Fundamental problem was 'hidden files' which I did not expect in Linux (>> I am relatively new to all Linux O/S)
    – Birdman
    Feb 22, 2023 at 18:06
  • DW, i was not offeded by you 'ignoring' me, it was simply the fact that you should not repost a question like this :) Also: when you are working with your profile or bash_rc i strongly recommend working with the terminal. (ls -la ;) )
    – Malik
    Feb 23, 2023 at 7:45
  • 99% percent of my problems that brought me to asking the question were due to the fact that, by default, Mint does not show "hidden" folders (and tbh, I didn't know that Linux-based OS had hidden files, given that most of them are locked up by restricted r/w permissions anyway). In short, once able to find the files it was easy to implement the changes in the way suggested here.
    – Birdman
    Feb 23, 2023 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .