FG
💻 Software

How to avoid tilde ~ in Bash prompt?

Fresh5 days ago
Mar 15, 202611566 views
Confidence Score0%
0%

Problem

I would like to remove the tilde from displaying within the PS1 variable. My current PS1 string: And the prompt looks like this: I don't like that the $HOME directory is displayed as tilde. Can this be avoided? It causes problems, example: Documentation says: Is there any possibility to avoid $HOME…

Error Output

PS1="\h:\w\n$"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to avoid tilde ~ in Bash prompt?

Low Risk

bash runs expansions in the prompt; just make sure to escape them.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment