Can't use Konsole after running bash script

When I run a bash script with right click → «Run In Konsole» I can’t enter other commands in the terminal. How can fix it?



I don’t think is currently possible to make Konsole behave like that after using the -e argument to run other things (what “Run in Konsole” action does under the hood). I don’t know why it doesn’t return to the shell by default but sounds like a reasonable feature to me. Can you file a bug report about this for konsole?

As a workaround you can edit the service menu in /usr/share/kio/servicemenus/konsolerun.desktop and replace the line

Exec=konsole --hold -e %f


Exec=konsole --hold -e sh -c '%f; $SHELL'

That should start your default shell after the script/executable finishes.

Note that this file will be overwritten when konsole updates so consider making a copy in ~/.local/share/kio/servicemenus/ and maybe with a different name so you can preserve the default one

You could run bash at the end of the script.

1 Like

Here with Konsole Version 22.12.3 and Dolphin Version 22.12.3

  • KDE Plasma Version: 5.27.9
  • KDE Frameworks Version: 5.103.0
  • Qt Version: 5.15.8

It seems to be a default behaviour of Konsole – if you type [Shift+Ctrl+T] a new Konsole Tab should appear where you can continue a Bash session.

  • You can then kill the display of the dead script process by closing the Konsole tab where the script was running.

The question remains, what happened to the process where the Bash script was executing?
You can try to track it down as follows:

 > ps -C dolphin
  PID TTY          TIME CMD
11703 ?        00:00:01 dolphin
18471 ?        00:00:12 dolphin
 > pstree --show-pids 11703
 > pstree --show-pids 18471
               │                ├─bash(19941)───man(20431)───less(20447)
               │                ├─bash(20453)───pstree(21368)
               │                ├─bash(20786)───man(20814)───less(20829)
               │                ├─bash(20839)
               │                ├─{konsole}(19597)
               │                ├─{konsole}(19598)
               │                ├─{konsole}(19599)
               │                ├─{konsole}(19600)
               │                ├─{konsole}(19601)
               │                ├─{konsole}(19602)
               │                └─{konsole}(20240)

You can then try to track down the Zombie process, if it exists at all – <>

konsole runs a shell if you don’t tell it something to run, but otherwise runs what you tell it to. Terminal emulators have been working like this for decades…