I manage software on a bunch of RHEL 6.10 VMs, typically either as a service account or root using sudo -i. Periodically, my shell starts dropping every other character. For example, if I type

cd /usr/local

what actually shows up is


It's not just cosmetic; if I press enter there, I get

-bash: d/s/oa: No such file or directory

The only solution I've found is to log out of the sudo session (with ^D^D because the first one is ignored) and log back in. This leads me to believe it's not an issue with my terminal or ssh client, but just in case, here's the full stack:

Human > Keyboard > Windows 10 > MobaXTerm > WSL OpenSuse > tmux > ssh > bash > sudo

Obviously, I could try removing tmux from the stack, or WSL altogether, but it would cramp my workflow and be difficult to troubleshoot, as it's an intermittent issue I only encounter about once a week.

What could be causing this?

  • Yeah, I've tried that. The odd-numbered characters are ignored, starting with the first. Jul 17, 2020 at 14:07
  • 10
    You've got two applications reading from stdin on the same terminal device (PTY) at the same time
    – roaima
    Jul 17, 2020 at 14:39
  • 1
    How would that happen? It literally just happens. I type a command, it's fine. Another, it's fine. One more, and now it's dropping every other character. Jul 17, 2020 at 16:18
  • 6
    if you are using Windows, never ask why..
    – alecxs
    Jul 18, 2020 at 14:47
  • 1
    If up to and including the bash you are fine and then only on sudo are you seeing an issue then you that is where the issue is. where do you start loosing the second character? I would check the path of the sudo command you are running and also have look at all your open file like here - unix.stackexchange.com/questions/333186
    – MoopyGlue
    Sep 10, 2020 at 14:38

3 Answers 3


I have this experience using Putty, RHEL 8, and XMing.

I forget to add XMing before the Putty session. I found that reversing it and doing XMing first then Putty solves it.

Or if I have run XMing then Putty to a server, to then jump via ssh without XAUTH verification, I press CTRL -C a few times.

XMing or VCXSRV are two tools to export display.

Either of these appear to clean the guck from the pipes and I type without issue. Is your experience similar?

  • the repeated stroke of Ctrl-C solved the issue for me on MobaXTerm
    – Zzirconium
    Nov 23, 2022 at 10:03

I have similar keyboard problems with a diferent (and longer) stack of communication programs, like getting invisible characters or rare codes, but I think they are caused by me inadvertently pressing a key combination that changes the terminal functions.

I really don't have time, as you say, for diving in the term definitions looking for which keys could provoke the change, like if pressing a+b+c during a furious typing session could cause the keyboard to send a XOFF ^S command to the remote terminal that stops sending output or something like that. We need a key capturing program to store the keys pressed and another in the remote for getting the received ones to troubleshooting. Also, as there are several programs involved, it is difficult to blame one or other of them.

In the mean time, sometimes a stty sane or reset command in the terminal solved this for me (because of these cases I think is a oscure key term command unknowingly causing the problem); other times I had to restart the shell as you do or even reconnect some portion of the stack.


Try using the lsof command as suggested by roaima in a comment to your question. Here is an example that show how bash and the lsof command both have file descriptor (FD) 0 (=stdin) opened, but neither of them are reading from it at the time of command execution. You should look for other processes that have file descriptor 0 open. Kill them one by one until the issue goes away. Not bash obviously, unless you see FD 0 opened multiple times by bash.

$ lsof /dev/pts/8
bash    15190 thisusr    0u   CHR  136,8      0t0   11 /dev/pts/8
bash    15190 thisusr    1u   CHR  136,8      0t0   11 /dev/pts/8
bash    15190 thisusr    2u   CHR  136,8      0t0   11 /dev/pts/8
bash    15190 thisusr  255u   CHR  136,8      0t0   11 /dev/pts/8
lsof    19576 thisusr    0u   CHR  136,8      0t0   11 /dev/pts/8
lsof    19576 thisusr    1u   CHR  136,8      0t0   11 /dev/pts/8
lsof    19576 thisusr    2u   CHR  136,8      0t0   11 /dev/pts/8

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .