1

I am trying out the timeout command and would like to know if there is a kill signal that a GUI program, whether a graphics desktop or a terminal program will treat as the user terminating the program from the UI, like a File| Exit command or clicking the X button on the window, thus prompting the use to save any open files.

kill -l displays over 64 options. Are any of them either alone in combination equivalent to a GUI option to terminate?

I have tried with nano as an example, but the options I have tried so far don't work except SIGTERM.

4
  • Depends on the application and window manager I guess but SIGINT should amount to the same thing.
    – goldilocks
    Aug 2, 2014 at 15:53
  • The question is not a duplicate of the others,and I am interested in the general case of all programs, not just graphics desktop based GUI programs. nano is not a graphical desktop program. I am interested in knowning if there is a command that Linux programs, whether graphical desktops or not, are required to treat as the equivalent of the user quitting it from the menu, or a key combination, either as an accepted standard or a respected convention. The vote to close is not applicable here.
    – vfclists
    Aug 2, 2014 at 16:41
  • 1
    No, there isn't any such thing. SIGINT might do it for some applications, but many will just use the default handler that just terminates the program. Quitting from the menu causes the program to exit cleanly, which may require extra processing that the default handler doesn't do.
    – Barmar
    Aug 3, 2014 at 9:45

1 Answer 1

1

No. The main signals which are conventionally used by a user to kill a process are:

  • SIGINT (sent by Ctrl+C in a terminal) — abort the current operation and go to the toplevel interactive loop. If the program doesn't have a toplevel interactive loop, kill the program.
  • SIGTERM — stop the program cleanly. This may do an emergency save.
  • SIGHUP — sent by the system to a program running on a terminal when the terminal goes away. Usually handled like SIGTERM.
  • SIGQUIT (sent by Ctrl+\ in a terminal) — die without any cleanup and dump core (for debugging).
  • SIGKILL — the program dies and doesn't get a chance to do any cleanup.

None of these have a conventional meaning whereby the program would prompt the user for anything. It could make sense for a program to prompt on SIGTERM, but I can't think of a program that does it. Some programs do prompt on SIGINT, offering a choice to return to toplevel or exit the program or enter a debugging mode. Generally speaking, the assumption when a program receives SIGTERM is that the user isn't in front of the console to interact with the program, or that the program isn't responding — otherwise the user would be using the interactive controls instead of sending a signal.

GUI events such as clicking on the x button in the window title bar don't send a signal, they send an event on the normal X11 communication channel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .