Renaming a Konsole session from commandline after ssh

别来无恙 提交于 2020-01-13 11:02:46

问题


I use dcop to rename a Konsole session, such as

dcop $KONSOLE_DCOP_SESSION renameSession "whatever"

However, when I ssh to a server and from there, I issue this command, it does not work and gives error:

ERROR: Couldn't attach to DCOP server!

Is there a way using dcop or otherwise to rename the Konsole session, even though I have ssh'ed to another computer.


回答1:


The remote server appears not be running dcop and even if it were, that's not the instance you want to be communicating with (dcopserver on the remote host vs dcop on your local host).

You can use XTerm escape sequences to change the title via:

remotehost $ echo -ne "\033]0;Custom Window Title\007"

You can also change the individual tab title via:

remotehost $ echo -ne "\033]30;Custom Tab Title\007"

Another way would be to suspend your current ssh session so that you are back at the login you started.

e.g.

host1 $ ssh host2
host2 $ ~^Z [suspend ssh]

[1]+  Stopped                 ssh host2
host1 $ dcop $KONSOLE_DCOP_SESSION renameSession "whatever"
host1 $ fg
ssh host2
host2 $ 


来源:https://stackoverflow.com/questions/8782159/renaming-a-konsole-session-from-commandline-after-ssh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!