How to permanently set $PATH on Linux/Unix

Ғылым және технология

Learn how to permanently set $PATH on Linux/Unix.
You can set the PATH environment variable, using the following command.
export PATH=$PATH:/path/to/my/binary/file/
However, each time you exit the terminal or SSH session, and start a new terminal session, this PATH is lost. You have to run the same command again to recover the path. How can you permanently set this path?
Here are the step on how to resolve it.
1) cd ~
2) sudo nano .bashrc
3) Add the following line at the very bottom of file .bashrc.
export PATH=$PATH:/usr/local/go/bin
4) Save the .bashrc and exit.
5) ctrl + D to exit the terminal
6) Log back again.
#linux #ubuntu #path

Пікірлер: 16

  • @ahmadali-yo8jm
    @ahmadali-yo8jm6 ай бұрын

    thank you for your usefull video, i have one question, is it possible to create a shell and and it set the path automaticlly in the bashrc after you run your bash for once?

  • @QuantumCanvas07
    @QuantumCanvas076 ай бұрын

    I can't find .bashrc under ls -al command. Basically the problem I'm facing is I'm not able to use sudo commands outside of its own file which is annoying.

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    6 ай бұрын

    Sounds like you need to use chown command to the folder. Let me know if you need more help about chow command.

  • @ned-gd7em
    @ned-gd7em Жыл бұрын

    you saved my day, thank you

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    Жыл бұрын

    I am happy it worked for you. Thanks for leaving a comment.

  • @adrianjesussilvavega583
    @adrianjesussilvavega583 Жыл бұрын

    Thanks, this is easy and so useful

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    Жыл бұрын

    You're welcome!

  • @fatimarehman2609
    @fatimarehman2609 Жыл бұрын

    How did you save it after typing the PATH command?

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    Жыл бұрын

    I am using Nano (a text editor for Linux) in the video and I am using Ctrl+X to save and exit. If you want to just save and continue using nano, press Ctrl + O. Just for the benefit of all other text editor user users, I have compiled how to save and save & edit keys combinations. 🎉Vim Users If you are using Vim, to save a file it is / vi, press Esc key, type :w and hit Enter key. If you want to save a file and quit the text editor, it is / vi by pressing Esc key, type :x and hit Enter key 🚀Vi Users If you are using Vi, to save a file press Esc on your keyboard to enter Command mode, and then type :w. If you want to save a file and quit the text editor, press Esc key to enter Command mode, and then type :wq. 👑Emacs Users If you are using Emacs, to save a file press Ctrl + x Ctrl + s. If you want to save a file and quit the text editor, press Ctrl + x Ctrl + c.

  • @unbyte
    @unbyte Жыл бұрын

    thanks man

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    Жыл бұрын

    No problem!

  • @danielhegedus8354
    @danielhegedus8354 Жыл бұрын

    thank you

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    Жыл бұрын

    You're welcome

  • @uomolercio1992
    @uomolercio19928 ай бұрын

    Thanks

  • @RabiGurungXybernetics

    @RabiGurungXybernetics

    8 ай бұрын

    Welcome

Келесі