expansion

Bash Tilde expansion

An eligible unquoted leading tilde expands to a directory; quoted tilde remains literal.

Formal Syntax & Structure

bash syntaxbash
~ / ~+ / ~-

Return Value

shell behavior

An eligible unquoted leading tilde expands to a directory; quoted tilde remains literal.

Working Example

Example Snippetbash
HOME=/demoprintf '%s\n' ~/notes '~' "$HOME/notes"
Bash Reference