Search code examples
linuxunixbin

when does executables from bin directory run


I have just started exploring linux, and I am having 1 basic question.

We have a directory /usr/bin where all user related binaries are stored. Now my question is when does these binaries run?

Do they run when a user wants to manually run them or do they run during start up only?

I can see that for my project, the application launcher files are stored in /usr/bin, but I am not able to figure out when does these launcher files gets executed?


Solution

  • for Linux/Unix most executables are stored in /usr/bin or /usr/local/bin/ /usr/sbin or something like that. It is a convention but not a requirement.

    you can run them manually ( assuming you have permission to do so )

    Linux/Unix has several methods of running files automatically

    at boot : files (scripts ) stored in /etc/init.d run at boot there is also /etc/inittab which can do the same thing

    on a schedule: things can be run via cron and each user can have his or her own cron schedule

    on login : each user can set up a ".profile " which is run at login so you could put stuff in here as well though this is usually reserved for login setup ( setting your path's and preferences )

    if your files in /usr/bin are not references in any of these places then they should only be running when you the user runs them.

    your application should have some doc explaining if it hooks into any the above auto run methods. I know this is a bit vague but the scope of your question is very broad.