What can I do to keep applications installed from disappearing?

us flag

So here's the deal:

  1. I use MS RDP to remote into a Ubuntu desktop
  2. I installed brew added to PATH, and then installed a number of applications
  3. I added a bunch of aliases

at any given time, if my session goes to sleep or times out, I log back in and brew cannot be found. I then need to re-apply Brew to $PATH and recreate my aliases.


Your help is very much appreciated.

ec flag
**Welcome to the Ask Ubuntu community.** When you say that you added brew to `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.
diky avatar
us flag
ah. That may be this issue. I am adding from CLI. Does Ubuntu create a new session every time it times out?
cn flag

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.

dm flag

$PATH environnement variable (as any variable) is transient for a terminal session. If your session times out, the terminal process (bash probably) is terminated and your variable modifications are lost. If you want to make it permanent, you have to edit ~/.bashrc or ~/.profile

See How do I modify my PATH so that the changes are available in every Terminal session for more information on how to edit these for permanent PATH modification.

You also have to put your aliases in one of these files so they are available the next time you reopen a terminal.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.