~in bash does not expand to your home directory (cd ~fails or goes nowhere useful)- Backticks around a command do not execute it —
`ls`is treated as literal text - Copy-pasting the characters out of your terminal into a Unicode inspector shows they are not ASCII
- Common setup where this appears: Lenovo (or other) USB keyboard → Android tablet → Termux → mosh/ssh to remote host
- Also reproducible with US-International or similar "dead-key" layouts on Linux/macOS desktops
Your keyboard is emitting Unicode modifier letters, not ASCII:
| What you type | What is emitted | Codepoint | What bash needs | Codepoint |
|---|---|---|---|---|
` |
ˋ MODIFIER LETTER GRAVE ACCENT |
U+02CB | ` GRAVE ACCENT |
U+0060 |
~ |
˜ SMALL TILDE |
U+02DC | ~ TILDE |
U+007E |
Bash, POSIX shells, and virtually all CLI tools only recognize the ASCII versions (U+0060 / U+007E). The Unicode modifier letters look nearly identical but are semantically different characters, so the shell treats them as ordinary text.
These keys are configured as dead keys in your active layout (e.g. "US International"). A dead key waits to combine with the next keystroke to form an accented letter (` + a = à). When the next key is space, nothing, or a non-combinable character, some layouts emit the spacing modifier letter (ˋ, ˜) instead of the plain ASCII character — which breaks shell usage.
On Android with an external keyboard, the layout is controlled by Android, not Termux.
Run one of these in your terminal, press the offending key, and check the output:
showkey -a # shows codepoint in hex/octal; expect 0x60 for ` and 0x7e for ~
cat # type the key + Enter; paste output into a Unicode inspector
printf '%s' '`' | xxd # should show 60, NOT cb 8b (UTF-8 for U+02CB)
printf '%s' '~' | xxd # should show 7e, NOT cb 9c (UTF-8 for U+02DC)If you see cb 8b / cb 9c instead of 60 / 7e, you have this bug.
- Settings → System → Languages & input → Physical keyboard
- Tap your keyboard name (e.g. "Lenovo …")
- Set up keyboard layouts → pick English (US) — not "English (US), International style"
- Test again in Termux.
# Check current layout
setxkbmap -query | grep -E 'layout|variant'
# Switch to plain US (no dead keys)
setxkbmap -layout usOr in your DE's keyboard settings, choose a variant without "dead keys" / "intl".
System Settings → Keyboard → Input Sources → pick U.S. instead of U.S. International — PC or ABC — Extended.
On most dead-key layouts, pressing the dead key twice or followed by space emits the literal ASCII character:
- Press
` `→ emits a single` - Press
`then Space → emits` - Same for
~
cd ~ # should land in $HOME
echo `whoami` # should print your usernameIf both work, you're done.
- Unicode: U+0060 (GRAVE ACCENT), U+007E (TILDE), U+02CB (MODIFIER LETTER GRAVE ACCENT), U+02DC (SMALL TILDE)
man xkeyboard-config— dead-key variants on Linux- Android's keyboard layout is shared across all apps, including Termux — there is no Termux-side override for physical keyboards