I need to open Konsole from the command line, because I need to write a script to open four Konsole terminals.
when I do :
linux-gn77:/home/harbir # konsole -e konsole
I get the following message:
unnamed app(4332): KUniqueApplication: Cannot find the D-Bus session server: "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
unnamed app(4331): KUniqueApplication: Pipe closed unexpectedly.
I am trying the above command as a root user.
I am also not sure if I am doing it correctly.
A program run as root user won’t find your user’s X and D-BUS session. And KDE applications need both.
Why do you have to run that as root?
What do you want to achieve?
And what exactly do you mean with “command line”?
Try “su -” instead of “su”. Or try “dbus-launch konsole”.
In text mode you would have to set the DISPLAY and DBUS_SESSION_BUS_ADDRESS variables accordingly and probably more.
And just “konsole” should be enough. No need to run “konsole -e konsole”.
Well, you could create four different profiles for that and set them with the --profile option, i.e.:
konsole --profile profile1
and so on.
You can set the working directory with the --workdir option.
The window’s (or rather tab’s) title can only be set in the profile, you can override this with the -p option (you can also override the working directory in that way). So either of those should work:
I currently have a konsole session open, which is where I normally do command line stuff. But I use “xterm” for temporary special-purpose terminals, usually for short-term use. When started by a script, that script can work just as well in “Icewm” or “Gnome” or “XFCE”, because “xterm” is more generic and not desktop-specific.
In any case, the main trick to starting a terminal session from a script is to put a “&” at the end of the command, so that the script doesn’t wait for that terminal to close. A secondary trick is to do it in a subshell (put parentheses around the command). This is useful if you want to first do a “cd”, so that the “cd” only affects the subshell and not the mainline script.
Have you thought of using the software named “screen”. Worth a look.
screen - A program to allow multiple screens on a VT100/ANSI Terminal
With this program you can take advantage of the multitasking abilities of your Linux system by opening several sessions over one terminal. The sessions can also be detached and resumed from another login terminal.