Interesting bug/feature found in Konsole: Meta+Letter lists hosts

I had a Konsole open and bumped my keyboard at-random with my left hand and I was surprised to see this on my screen:

BASH on Manjaro Linux arthur@optiplex-major Mon 2024-10-28, 11:20:31 AM
~/Belequenta/rhe/PWCC/293
%
::1             ff02::1         ff02::2         ip6-allnodes    
ip6-allrouters  ip6-localhost   ip6-loopback    localhost       
optiplex-major  

BASH on Manjaro Linux arthur@optiplex-major Mon 2024-10-28, 11:20:31 AM
~/Belequenta/rhe/PWCC/293
%sz

On experimenting, I found that the Meta key combined with any letter key not assigned to any keyboard shortcut will list hosts, then after the prompt returns, will pre-type “s” followed by the letter. (In the case quoted above, I hit Meta+z, so I got “sz” on the next line.)

So, what is going on there? Is this a bug or is this a feature? Is this documented anywhere?

What is:
“Belequenta” ?

It seems to be in your shell’s $PATH
and you managed to add three sub-directories to the command, too
with one bump to the keyboard …

It is a directory.

No. Though, certain subdirectories of it are. That is not relevant here though.

No. The “command” is the invisible “Meta+z” which appears as the empty string after first “%”. The result of the “command” is to first list hosts, then return the prompt, then pre-type “sz” into the next line.

I think you’re confusing my 3-line prompt for “commands” and/or “responses”. No, it’s just a prompt. The issue isn’t related to the prompt or even the shell; it’s a Konsole-specific thing. I can ditch BASH entirely and open an SH shell instead and I get the same results if I type Meta+Letter for any letter not assigned to a keyboard shortcut. For example:

sh-5.2$ 
::1             ff02::1         ff02::2         ip6-allnodes    
ip6-allrouters  ip6-localhost   ip6-loopback    localhost       
optiplex-major  
sh-5.2$ sz

There, the “sh-5.2$” is the prompt, the “command” is an invisible Meta+z, and the “response” to the command is the listing of hosts, the return of the prompt, and the weird pre-typing of “sz” after the prompt.

Addendum: Oddly, it doesn’t work with ZSHELL. So apparently the choice of shell does have something to do with it.

I know, I noticed …

I disagree - especially with:

That is not relevant here though.

I think it very much might be :man_shrugging:

What command do you think/suppose is getting executed to give you that output?
After running something two levels below ~/Belequenta

anyway:
I can’t replicate.

(with bash - I use bash - not zsh
and without knowing what is two levels below ~/Belequenta)

Meta+Letter for any letter not already assigned to any keyboard shortcut, when typed into a BASH shell in a Konsole console in Manjaro-Plasma Linux.

The CWD is irrelevant. The phenomenon occurs in any CWD. You could be in “/home/bob/nachos” or “/opt/myapp/somefolder” or whatever.

Steps to replicate:

  1. Use a Manjaro-Plasma system.
  2. Open a “Konsole” console.
  3. Run a BASH or SH shell.
  4. Type Meta+Z or Meta+N

If that still doesn’t replicate it for you, then this [bug|feature] may not occur on every system. Though, there’s nothing especially non-standard about the system I’m using, so I’d be surprised if no one else can replicate this.

… hold my beer - I will respond honestly once my Manjaro Plasma VM has been booted up
I do not have a real Manjaro Plasma system.
I have switched from zsh to bashright from the start - bash is the system shell and also what is used in Konsole.

Why would you have mentioned:

if it didn’t matter where you are …
?

I don’t really understand why, but it seems to have been a “feature” for a while

https://unix.stackexchange.com/questions/636763/why-is-bash-listing-the-effective-content-of-etc-hosts-if-i-press-super-lspace

Edit: It is to do with the emacs key bindings used by bash; I think they are the default. For instance, if you switch to vi bindings, then Meta+z instead adds some control chars to the input line

~$ set -o vi
~$ ^X@sz
3 Likes

I didn’t “mention” anything. I just copy-pasted exactly what was on my screen, in the spirit of “not cooking the data”.

I then pointed out in subsequent replies that CWD doesn’t matter, and demonstrated that the phenomenon also occurs in the SH shell.

Here, I’ll demonstrate it in 3 different CWDs, in SH, with a much simpler prompt:

sh-5.2$ cd /
sh-5.2$ 
::1             ff02::1         ff02::2         ip6-allnodes    
ip6-allrouters  ip6-localhost   ip6-loopback    
localhost       optiplex-major  
sh-5.2$ cd ~
sh-5.2$ 
::1             ff02::1         ff02::2         ip6-allnodes    
ip6-allrouters  ip6-localhost   ip6-loopback    
localhost       optiplex-major  
sh-5.2$ cd /opt/ventoy
sh-5.2$ 
::1             ff02::1         ff02::2         ip6-allnodes    
ip6-allrouters  ip6-localhost   ip6-loopback    
localhost       optiplex-major  
sh-5.2$ sz

In each case, the “prompt” is “sh-5.2$”; the “command” is the invisible Meta+z which I typed at each empty prompt line; and the “result” is the listing of hosts, followed by return of prompt, followed by the printing of “sz” after the next prompt.

The CWD or $PATH don’t figure into it at all. And I wouldn’t expect them to; this appears to be something in the machine-language code of the Konsole program itself. Here, I’ll prove that by emptying the PATH variable completely:

sh-5.2$ export PATH=''
sh-5.2$ echo $PATH

sh-5.2$ 
::1             ff02::1         ff02::2         ip6-allnodes    
ip6-allrouters  ip6-localhost   ip6-loopback    
localhost       optiplex-major  
sh-5.2$ sz

PATH is empty, and we’re in directory “/opt/ventoy”, and yet Meta+z still lists hosts. So it’s apparently in Konsole itself.

Couldnt replicate until Super+Space. That one prints /etc/hosts.

( on Bash here )

The link by @Phemisters above seems to have all the explanations.

Interesting. It appears to be both a “feature” (in that it was deliberately put into Konsole 12 years ago for Emacs purposes), and a “bug” (in that outside of Emacs, the behavior is unexpected). Could be useful, though, as a quick way to get a list of hosts.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.