A variable or alias set interactively lasts in that shell, not automatically in future sessions. Shell startup files can run commands as a new shell starts. Which files are read depends on the shell, whether it is interactive or a login shell, and system configuration. Interactive Bash commonly reads ~/.bashrc; interactive Zsh commonly reads ~/.zshrc. Login startup behavior differs, and a Bash login setup may or may not arrange to read .bashrc.
These are executable shell code, not passive preference lists. Inspect and back up existing files before editing them; do not replace them with an example. Add only settings you understand. A new applicable shell can read the change. The command . ~/.bashrc executes the entire Bash file again in the current shell, including any side effects; use the Zsh file for Zsh and never source untrusted content. Repeated execution can duplicate changes such as PATH entries.
Search order and aliases
PATH is a colon-separated list of directories used when looking for an executable by name. Shell functions, builtins, aliases and cached results can also affect resolution; command -v name reports how the current shell resolves a name, if it can. A path containing / is used directly rather than searched through PATH.
For a session with a nonempty PATH containing no empty components, this appends a trusted personal directory:
export PATH="$PATH:$HOME/bin"
Earlier directories still take precedence; this does not create ~/bin. An empty PATH component may cause the current directory to be searched, so avoid creating one. Do not add directories writable by untrusted users. A persistent version can be placed in the appropriate startup file after checking its existing contents and startup behavior. Reopening a shell does not update already-running shells.
An alias is a shell shortcut rather than a program:
alias longlist='ls -la'
alias longlist
unalias longlist
The second line displays the definition; the third removes it from the current shell. In an interactive shell, entering longlist as a command expands the alias. Expansion rules vary by shell and context; aliases are not a substitute for a portable script. Put a useful definition in the appropriate startup file if it should be recreated in future sessions, and remove it there as well when it is no longer wanted.