how to add directory to path ubuntu code example

Example 1: how to add path in ubuntu

# Edit .bashrc, or .zshrc in your home directory and add the following line:

export PATH="/path/to/dir:$PATH"

$ source ~/.bashrc
source ~/.zshrc

Example 2: how to add a directory to path

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

Example 3: how to add a directory to path in linux

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

Example 4: ubuntu export path

$ source ~/.bashrc

Example 5: how to add a directory to path in linux

nano ~/.bashrc