While using Konsole as my terminal emulator, I realized that in addition to typing exit or hitting Ctrld, I can also click "close tab" and it closes it. What's interesting though is that sometimes it requires confirmation and sometimes it doesn't. For example, when I run "cat" and while it's running try to close the tab, I get an "are you sure?" dialog screen. But when it's at the terminal prompt, no such window gets open. How can the terminal emulator tell whether it's safe to simply close the window?

  • 1
    It's probably checking if your shell has child processes - try running something in the background (like top &) and see if the warning also appears. In your shell, try pgrep -P $$ to check for child processes
    – Panki
    May 26, 2022 at 13:34
  • It doesn't show the warning. So it basically keeps the pid of the process it spawned and does something like pstree -p $THAT_PID?
    – d33tah
    May 26, 2022 at 13:35

1 Answer 1


When you close a tab, Konsole checks whether a “foreground process” is activewhether the current foreground process in the tab’s session is not the session’s process group leader (which is the shell, for tabs which start by running a shell). Thus when you’re at the shell prompt, there’s no confirmation, even when “background” processes are running. When the tab is running something other than its process group leader in the foreground, Konsole asks for confirmation.

The same check runs when you close the whole window.

You must log in to answer this question.

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