Skip to content
Advertisement

How to set PATH in Ubuntu 17.10 for custom path

I made a folder called bin in /home/USER/bin on this, I created a file called hello ( for example) with this code:

#!/bin/bash    
echo My first program

I did execute export PATH=$PATH":$HOME/bin" and then $ . ~/.bashrc, but when I restarted the PATH is restored to default.

How can I resolve it?

Thank you!

Advertisement

Answer

The user bin directory should already be added to your path by the ~/.profile script.

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

Did you add the export line to your ~/.bashrc file?

export PATH="$HOME/bin:$PATH"
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement