how to add path in ubuntu

C++
export PATH="$HOME/bin:$PATH"
# Edit .bashrc, or .zshrc in your home directory and add the following line:

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

$ source ~/.bashrc
source ~/.zshrcexport PATH="/path/to/dir:$PATH"
$ source ~/.bashrc

Source

Also in C++: