0

I'm using Ubuntu 14.04 (as a virtual machine). I installed TeX Live system over the internet.
Once the installation of TeX live finished, it said

Most importantly, add /usr/local/texlive/2015/bin/x86_64-linux
to your PATH for current and future sessions.

So, I typed the following command in the terminal.

PATH=/usr/local/texlive/2015/bin/x86_64-linux

It didn't throw any error or did not ask any questions / confirmation.

When I tried to run clear command on the terminal it said

Command 'clear' is available in '/usr/bin/clear'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
clear: command not found

What have I done wrong? and more importantly how do it fix it?

However if I close the terminal and re open the terminal, everything seems to be normal. Now will TeX live work?

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Prasanna
  • 4,036
  • 5
  • 34
  • 51
  • 3
    Possible duplicate of [What are PATH and other environment variables, and how can I set or use them?](http://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them) – DavidPostill Feb 10 '16 at 15:32

1 Answers1

1

You've temporarily redefined where your system looks to find important commands.

What you want is this:

PATH=/usr/local/texlive/2015/bin/x86_64-linux:$PATH

That redefines $PATH as the textlive directory AND what $PATH was before.

Re-open your terminal and the re-assignment will be lost, so everything is back to normal.

To update the $PATH permanently, add the line to ~/.profile (or ~/.bash_profile if you only want it to affect bash.)

See also: https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path and Difference between .bashrc and .bash_profile

DMCoding
  • 223
  • 3
  • 12
  • should I make this as a permanent change to work with TeX live? Because, it seems to work even after restarting the terminal. So I don't understand the `Most importantly, add /usr/local/texlive/2015/bin/x86_64-linux to your PATH for current and future sessions.` message shown during the installation – Prasanna Feb 10 '16 at 12:10
  • I have edited my answer with information about doing that. – DMCoding Feb 10 '16 at 14:42
  • 2
    @Prasanna Notice the **add** in `Most importantly, ADD /usr/local/te...` Add it to the path. Not replace thew old path with a new. – Hennes Feb 10 '16 at 14:45
  • It's an easy mistake to make though! – DMCoding Feb 10 '16 at 14:45
  • @Prasanna The PATH variable contains all the paths which will be searched by the terminal when you type a command. E.g., if you type "echo hello," the terminal doesn't just magically know where 'echo' is located, it will actually search through each directory in your path until it finds an executable named 'echo.' The installation instructions tell you to add texlive to your PATH so that you can access the files in that folder without having to type out the entire folder name. You are supposed to *add* that directory to your PATH, not replace your PATH entirely. – Layne Bernardo Dec 24 '20 at 22:31