Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 705
judlup Avatar asked Nov 27 '25 11:11

judlup


1 Answers

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"
like image 97
Corey Taylor Avatar answered Nov 30 '25 06:11

Corey Taylor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!