Termux
Add to PATH
Edit .bash_profile
file.
Append the PATH to PATH=$PATH:$HOME/.local/bin:$HOME/bin,
.
End result will be PATH=$PATH:$HOME/.local/bin:$HOME/bin:/home/ec2-user/pear/bin
PATH="$PATH:/data/data/com.termux/files/home/.cargo/bin"
PATH=$PATH:~/opt/bin
or
PATH=~/opt/bin:$PATH
depending on whether you want to add ~/opt/bin at the end (to be searched after all other directories, in case there is a program by the same name in multiple directories) or at the beginning (to be searched before all other directories).
You can add multiple entries at the same time. PATH=$PATH:~/opt/bin:~/opt/node/bin
or variations on the ordering work just fine. Don't put export at the beginning of the line as it has additional complications (see below under “Notes on shells other than bash”).
If your PATH gets built by many different components, you might end up with duplicate entries.