A change to an environmental variable is only in effect in the current shell, i.e., the shell that is active when you type the command. An exported variable and an alias are only active in the current shell and all subshells (i.e., when you open a new terminal by loading your terminal emulator from the current terminal).
To have persistent variable definitions and alias definitions, valid as soon as you are logged in:
include the environmental variable definitions (e.g. PATH
) in your ~/.profile
file. That file is read when you log in and will be available to any application you launch, either from the menu or the terminal.
include alias definitions in your ~/.bashrc
file. That file is read anytime you open an new interactive terminal and so will be available in any terminal (but not elsewhere).
Note: while your alias definitions also could be included in profile
, it makes more sense to include them in ~/.bashrc
so they only are defined in an interactive terminal and not elsewhere.
PATH
how exactly are you doing that? Are you editing the.bashrc
file of the remote user, or adding them to the session (from command line)? If the latter, then these settings are transient: they'll go away when the session is closed. Same is true when setting up aliases. – richbl Jun 07 '23 at 19:59