When I type a long command on a command-line interface. Something strange may happen in the layout. The characters I typed don't show in lines correctly. Instead, they merge into 1 line or overwrite each other. And the cursor isn't displayed in its right place. For example:
I want to type:

/home/user/example/a/b/c>$ tar --create --file example.tar e  

But it shows:

xampleuser/example/a/b/c>$ tar --create --file example.tar e  

As shown above, the second line overwrite the first line.
This problem happens in Linux on different computers. I've met similiar problems both in tty and GUI terminal emulator. It's only a problem in the display, because what I type is exactly what I enter, although it may not be what is shown.
I use American keyboard. The encoding and keymap settings are all the default ones. The keyboard is fine.
More details:

  • font: terminus-132n(tty), terminus 24pt(GUI terminal emulator)
  • OS: Linux 5.18.15-arch1-1
  • $LANG: en_US.UTF-8

1 Answer 1


Try this...

Enter this command:

export PS1="$PWD>"

Then try a long command and see if the behavior changes. If it does, there's most likely a problem with the PS1 definition in your profile. When customizing PS1 try not to get too fancy, and avoid special characters and control codes if at all possible.

  • If it's bash, they most likely forgot to put non-printing characters between \[ and \]. Or, they put escape-sequences anywhere but within %{ ... %} in the zsh shell's prompt.
    – Kusalananda
    Aug 2, 2022 at 6:44
  • Agreed, but to determine that, my suggestion is to make PS1 very simple and see if the behavior changes.
    – mikem
    Aug 2, 2022 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy