0

I know similar questions have been asked before on here (for example: How to add a directory to the PATH?)

However, I don't know what to add and where to add this.

If I open ~/.profile, it looks like this:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"

Now I want to add a directory to this

/home/newsof/mypackage/TT/V1_1

How can I add this permanently?

  • @Zanna please read above, I know this is said before, I just could not use the previous answer understandable. I mentioned that in my text – Moh Mar 3 '17 at 22:20
  • I read your question, but I don't see your challenge. The answers to that post are very good. Add a new line to the end of your ~/.profile saying PATH=$PATH:/home/newsof/mypackage/TT/V1_1 – Zanna Mar 3 '17 at 22:23
  • @Zanna if I do that then I also should export PATH=$PATH:/home/newsof/mypackage/TT/V1_1 ? it is a temporary solution as it is said in another post like this one askubuntu.com/questions/109381/… and this one askubuntu.com/questions/402353/… – Moh Mar 3 '17 at 22:28
  • no you don't need to export it (that is temporary as you say), just log out and log back in or type source ~/.profile It's permanent – Zanna Mar 3 '17 at 22:30
  • @Zanna really sorry for asking too many questions. what will happen to the other path default ? is it not better to add this one ? PATH="$HOME/bin:$HOME/.local/bin:$PATH:/home/newsof/mypackage/TT/V1_1" – Moh Mar 3 '17 at 22:32
0

You can use /etc/environment to set PATH environment variable, but it does not support variable expansion.

See this Link to get more information about enviroment variables

  • better to set it locally, unless there is a very good reason for using /etc/environment – Zanna Mar 3 '17 at 22:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.