How do I add to PATH?

To add a directory to your PATH environment variable in a Unix-like system, you can follow these steps:

  1. Open your terminal.

  2. Edit your shell configuration file:

    • For Bash, use:
      nano ~/.bashrc
    • For Zsh, use:
      nano ~/.zshrc
  3. Add the following line at the end of the file:

    export PATH="$PATH:/path/to/your/directory"

    Replace /path/to/your/directory with the actual path you want to add.

  4. Save the file and exit the editor (in nano, press CTRL + X, then Y, and Enter).

  5. Apply the changes by running:

    source ~/.bashrc

    or for Zsh:

    source ~/.zshrc

Example:

If you want to add a directory called scripts in your home folder, you would add:

export PATH="$PATH:$HOME/scripts"

Now, you can run scripts or executables in that directory from anywhere in the terminal. Let me know if you need further assistance!

0 Comments

no data
Be the first to share your comment!