How to open Konsole with pre-typed commands in multiple tabs?

Is it possible, maybe there is some good macros tool to do it?
I have tried ‘–new-tab’ argument but it doesn’t seem to work when multiple konsole instances are running, ’ --tabs-from-file’ works weirdly and I cannot figure out how to do it.

You would probably have to script it. I do it with yakuake over dbus to open four tabs and run three different commands on startup.

See this:
https://docs.kde.org/stable5/en/konsole/konsole/command-line-options.html

Example file describing two tabs:

# file $HOME/my-tabs:
command: top
command: sh

will open a konsole window with 3 tabs, the last two additional tabs are the ones defined in the file.

Run: konsole --tabs-from-file $HOME/my-tabs

3 Likes

This is elegant. Just a side note:
history can be used by atuin as well
and if you end your complex command with #pattern you can filter by typing it
after up-arrow/Ctrl+R. (The communication with atuin server is encrypted. They can’t read your commands)

Is there something like autohotkey suitable for linux?

@manuel
I remembered the issue with tabs-from-file thing, when I stop something in a tab - tab closes itself. It works but just not quite as I would like it to.

@d-air1
Konsole works well for me so I would rather not change it for something else, at least without trying to figure out other ways.

I wasn’t suggesting you change it and also yakuake is part of the KDE suite and uses konsole at its core all of your konsole settings will apply to yakuake. Its just a dropdown terminal.

The reason I brought up yakuake was to say that if I can script it via dbus. Then you can script konsole via dbus. Since like I mentioned yakuake uses konsole as its core.