Jump to content
  • How to Start a Linux Program from Terminal and Close the Terminal Without Closing the Program



    When using Linux, it's common to start applications from the terminal for various reasons. However, in some cases, you may want to start a program from the terminal and then close the terminal without closing the program. This can be done using the setsid command followed by the program name and the exit command.

    To start a program using setsid, simply open the terminal and type:

    setsid programname

    Replace "programname" with the actual name of the program you want to start. This command will start the program in a new session, allowing you to close the terminal without affecting the program.

    To close the terminal without closing the program, you can combine the setsid command with the exit command by using &&. This will execute both commands in sequence, starting the program and then exiting the terminal. The full command would look like this:

    setsid programname && exit

    Once you enter this command in the terminal, the program will start in a new session and the terminal will close without closing the program. This can be useful when you need to start a long-running program from the terminal but want to free up the terminal for other tasks.

    In conclusion, starting a Linux program from the terminal and then closing the terminal without closing the program can be easily achieved using the setsid command followed by the program name and the exit command. This simple technique allows for more flexibility and efficiency when working with Linux programs.


    MidnightMaster95
    • 73 views

     Share

     Share


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.