Quantcast
Channel: User Dennis Williamson - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 61

Answer by Dennis Williamson for Change terminal prompt Ubuntu

$
0
0

In Bash 4 and later, you can use the special variable PROMPT_DIRTRIM. The escapes \w or \W are available in at least Bash 3.2 and later. These features can be used to control the length of the current directory as displayed in your prompt.

PROMPT_DIRTRIM
If set to a number greater than zero, the value is used as the number of trailing directory components to retain when expanding the \w and \W prompt string escapes (see PROMPTING below). Characters removed are replaced with an ellipsis.

\w
the current working directory, with $HOME abbreviated with a tilde (uses the value of the PROMPT_DIRTRIM variable)

\W
the basename of the current working directory, with $HOME abbreviated with a tilde


Viewing all articles
Browse latest Browse all 61

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>