Developers · Updated 11 Oct, 05:43 pm IST
Quoted tilde in PATH can leave literal ~/.local/bin entry, not $HOME

Why it matters for readers: It's a small shell quirk: quoted ~ won't expand, so prefer $HOME to get predictable paths.
- Adding a quoted tilde in PATH ("~/.local/bin") can result in a literal ./~/.local/bin directory being used instead of /home/<user>/.local/bin, because tilde expansion does not occur when quoted.1
- Bash documentation shows tilde expansion happens only for unquoted tilde-prefixes, and the observed behavior matches that rule.1
- Using $HOME (export PATH="$PATH:$HOME/.local/bin/") avoids the problem and is the recommended fix.1
- An unquoted assignment (export PATH=$PATH:~/.local/bin) can work in Bash and Zsh, but relying on unquoted tildes is fragile and can break with whitespace or other changes.1
Get a brief like this every morning
Uzha reads hundreds of sources and gives you the stories that matter for your work, with every source linked. Free.
Get started