1

My current understanding is that commands added to these two files are run every time a new terminal is open. Is that correct? Because in a lot of places I see suggestions to put there commands I want to be executed at login, but if they get executed every time I open a new terminal, then I do not want that. Can you help me understand how they work? Also what is the difference between them?

If I understand them correctly, then where can I put commands that I want to be executed only on login, but not every time a new terminal is opened? I know that I can do that from the GUI for "startup applications", but I am interested in doing this in a file, if possible.

Ven
  • 489
  • For launching some GUI based apps use "startup applications". Thsta the correct way. If you wish to run some daemon or script after reboot - use cron: crontab -e and add @reboot your_command or /path/to/script.sh – Ivan Temchenko Feb 28 '16 at 15:57
  • for some good info on this and how it works: man bash and skim to "Invocation". – Rinzwind Feb 28 '16 at 17:39
  • Thing is that I have created several chrome desktop apps that run in separate windows by choosing "More tools > Add to desktop" from chrome, and I can run them by clicking the shortcut on the desktop. I want to run some of them on startup and I have tried adding these commands to "startup applications", but I have a weird problem - only one of them can be in startup applications at a time - when I add another one it overwrites the previous one. I can add other applications just fine. I am guessing that this has something to do with the fact that they are all instances of chrome? – Ven Feb 28 '16 at 18:46

1 Answers1

6

To put it (very) simple: ~/.profile is sourced when you log in, while ~/.bashrc is sourced when you open a terminal window.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94