How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
That is the whole line is taken up with the current directory!
I would be happy if only the lowest dir level is showing, e.g.:
rgm@LX140e-3:dki-try2$
Or some such.
But not to make a permanent behavior change, as MOST of the time, seeing where I am is helpful.
thanks
On 12.03.2025 10:42 Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
That is being controlled by $PS1 in bashrc (or the config of another command interpreter like ksh if you use that).
You can set that temporary by issuing PS1= with the content you want.
Please check the bashrc for the current value.
On Wed, 2025-03-12 at 15:48 +0100, Marco wrote:
On 12.03.2025 10:42 Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
That is being controlled by $PS1 in bashrc (or the config of another command interpreter like ksh if you use that).
You can set that temporary by issuing PS1= with the content you want.
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
poc
On Wed, 2025-03-12 at 10:42 -0400, Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
That is the whole line is taken up with the current directory!
Depending on your terminal, you *may* be able to have the full path showing in the title bar, and just the current directory name at the command prompt.
Changing the \w to \W in your PS1= .bashrc string does it for some of them (just shows the last directory of the filepath).
By way of example, typing this into my command line let me change the current prompt without making permanent changes to my settings:
export PS1="[\u@\h \W]$ "
[username@hostname directory]$
On 3/12/25 10:59 AM, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:48 +0100, Marco wrote:
On 12.03.2025 10:42 Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
That is being controlled by $PS1 in bashrc (or the config of another command interpreter like ksh if you use that).
You can set that temporary by issuing PS1= with the content you want.
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
And I am using Xfce:
$ echo $PS1 [\e]133;D;$?\e\\e]133;A\e\]${PROMPT_START@P}[\e[${PROMPT_COLOR}${PROMPT_HIGHLIGHT:+;$PROMPT_HIGHLIGHT}m]${PROMPT_USERHOST@P}[\e[0m]${PROMPT_SEPARATOR@P}[\e[${PROMPT_DIR_COLOR-${PROMPT_COLOR}}${PROMPT_HIGHLIGHT:+;$PROMPT_HIGHLIGHT}m]${PROMPT_DIRECTORY@P}[\e[0m]${PROMPT_END@P}$[\e[0m] [\e]133;B\e\]
Wow!
So a simple test:
PS1="rgm@LX140e-3:dki-try2$ " rgm@LX140e-3:dki-try2$
Oh course, I loose all the nice coloration.
On 3/12/25 11:16 AM, Tim via users wrote:
On Wed, 2025-03-12 at 10:42 -0400, Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
That is the whole line is taken up with the current directory!
Depending on your terminal, you *may* be able to have the full path showing in the title bar, and just the current directory name at the command prompt.
Changing the \w to \W in your PS1= .bashrc string does it for some of them (just shows the last directory of the filepath).
By way of example, typing this into my command line let me change the current prompt without making permanent changes to my settings:
export PS1="[\u@\h \W]$ "
[username@hostname directory]$
That is quite better than what I hand coded, as it tracks changes in the current directory.
Maybe to add coloration.
On 12.03.2025 11:17 Robert Moskowitz wrote:
On 3/12/25 10:59 AM, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:48 +0100, Marco wrote:
On 12.03.2025 10:42 Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
That is being controlled by $PS1 in bashrc (or the config of another command interpreter like ksh if you use that).
You can set that temporary by issuing PS1= with the content you want.
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
And I am using Xfce:
$ echo $PS1 [\e]133;D;$?\e\\e]133;A\e\]${PROMPT_START@P}[\e[${PROMPT_COLOR}${PROMPT_HIGHLIGHT:+;$PROMPT_HIGHLIGHT}m]${PROMPT_USERHOST@P}[\e[0m]${PROMPT_SEPARATOR@P}[\e[${PROMPT_DIR_COLOR-${PROMPT_COLOR}}${PROMPT_HIGHLIGHT:+;$PROMPT_HIGHLIGHT}m]${PROMPT_DIRECTORY@P}[\e[0m]${PROMPT_END@P}$[\e[0m] [\e]133;B\e\]
Wow!
So a simple test:
PS1="rgm@LX140e-3:dki-try2$ " rgm@LX140e-3:dki-try2$
Oh course, I loose all the nice coloration.
Check the bashrc for ${PROMPT_DIRECTORY@P}.
On 3/12/25 11:51 AM, Marco wrote:
On 12.03.2025 11:17 Robert Moskowitz wrote:
On 3/12/25 10:59 AM, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:48 +0100, Marco wrote:
On 12.03.2025 10:42 Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
That is being controlled by $PS1 in bashrc (or the config of another command interpreter like ksh if you use that).
You can set that temporary by issuing PS1= with the content you want.
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
And I am using Xfce:
$ echo $PS1 [\e]133;D;$?\e\\e]133;A\e\]${PROMPT_START@P}[\e[${PROMPT_COLOR}${PROMPT_HIGHLIGHT:+;$PROMPT_HIGHLIGHT}m]${PROMPT_USERHOST@P}[\e[0m]${PROMPT_SEPARATOR@P}[\e[${PROMPT_DIR_COLOR-${PROMPT_COLOR}}${PROMPT_HIGHLIGHT:+;$PROMPT_HIGHLIGHT}m]${PROMPT_DIRECTORY@P}[\e[0m]${PROMPT_END@P}$[\e[0m] [\e]133;B\e\]
Wow!
So a simple test:
PS1="rgm@LX140e-3:dki-try2$ " rgm@LX140e-3:dki-try2$
Oh course, I loose all the nice coloration.
Check the bashrc for ${PROMPT_DIRECTORY@P}.
I have changed PS1:
echo $PS1 [\u \W]$
So that PROMPT_DIRECTORY is not what is displayed:
[rgm dki-try2]$ echo ${PROMPT_DIRECTORY@P} ~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2
PS1 seems to be what I want to play with...
Am 12.03.2025 um 11:56:59 Uhr schrieb Robert Moskowitz:
I have changed PS1:
echo $PS1 [\u \W]$
So that PROMPT_DIRECTORY is not what is displayed:
All the other stuff won't too. If that is what you want, you can now edit the ~.bash_rc to make that permanent.
[rgm dki-try2]$ echo ${PROMPT_DIRECTORY@P} ~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2
I think you have to check the original value in bash_rc.
I don't want it permanent. this whole process is to deal with those specific times I am working on a project in a very deep directory.
I have a dozen terminal windows open right now in 5 workspaces; it is only 2 that are on this project (working on the scripts for draft-ietf-drip-dki-05).
I do appreciate your guidance!
On 3/12/25 12:03 PM, Marco Moock wrote:
Am 12.03.2025 um 11:56:59 Uhr schrieb Robert Moskowitz:
I have changed PS1:
echo $PS1 [\u \W]$
So that PROMPT_DIRECTORY is not what is displayed:
All the other stuff won't too. If that is what you want, you can now edit the ~.bash_rc to make that permanent.
[rgm dki-try2]$ echo ${PROMPT_DIRECTORY@P} ~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2
I think you have to check the original value in bash_rc.
On Wed, 12 Mar 2025 12:09:21 -0400 "Robert Moskowitz" rgm@htt-consult.com wrote:
I don't want it permanent. this whole process is to deal with those specific times I am working on a project in a very deep directory.
I have a dozen terminal windows open right now in 5 workspaces; it is only 2 that are on this project (working on the scripts for draft-ietf-drip-dki-05).
I do appreciate your guidance!
xterm -title xxxx urxvt -title xxxx
For more exotic "terminals", see the associated documentation.
On Wed, 12 Mar 2025 at 16:09, Robert Moskowitz rgm@htt-consult.com wrote:
I don't want it permanent. this whole process is to deal with those specific times I am working on a project in a very deep directory.
It seems like you're covered with just tweaking your PS1 but if you wanted more conditional behaviour, have a look at PROMPT_DIRTRIM (cf: https://stackoverflow.com/a/8428363)
If you want to only change the prompt for a specific directory, or set of directories, https://direnv.net/ is just the ticket (and already available from the Fedora repos.)
Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
That is the whole line is taken up with the current directory!
I would be happy if only the lowest dir level is showing, e.g.:
rgm@LX140e-3:dki-try2$
Or some such.
But not to make a permanent behavior change, as MOST of the time, seeing where I am is helpful.
Set PROMPT_DIRTRIM=1 (or whatever number of directory levels you want to display). Just type that and hit enter, no need to export it or anything.
When done, unset the variable, e.g.: unset PROMPT_DIRTRIM.
Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:48 +0100, Marco wrote:
On 12.03.2025 10:42 Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
That is being controlled by $PS1 in bashrc (or the config of another command interpreter like ksh if you use that).
You can set that temporary by issuing PS1= with the content you want.
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
You may be talking about different things. PS1 applies to the shell running in the terminal. It sounds like you're thinking of the terminal window's title, perhaps?
Or perhaps you meant that setting it in ~/.bashrc has no effect when you start a new konsole? (Though that should not be the case.)
It could apply if it were in ~/.bash_profile or ~/.profile, as those are only read by login shells and konsole (as well as many other GUI terminal apps don't start bash (or whatever) as a login shell.
But that's getting far off in the weeds in terms of guessing what you might have meant. ;)
All that said, if this were for a temporary change as the OP wanted, you wouldn't write it to a file at all, but rather just set it via typing "PS1=..." and hitting enter.
Then you change it back to your default after (either by typing the original PS1, having saved it in another var before resetting it, sourcing the bash config again, or a number of other ways.
On 3/12/25 3:22 PM, Todd Zullinger wrote:
Robert Moskowitz wrote:
How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
That is the whole line is taken up with the current directory!
I would be happy if only the lowest dir level is showing, e.g.:
rgm@LX140e-3:dki-try2$
Or some such.
But not to make a permanent behavior change, as MOST of the time, seeing where I am is helpful.
Set PROMPT_DIRTRIM=1 (or whatever number of directory levels you want to display). Just type that and hit enter, no need to export it or anything.
When done, unset the variable, e.g.: unset PROMPT_DIRTRIM.
$ PROMPT_DIRTRIM=1 rgm@LX140e-3:~/.../dki-try2$
So a reasonable approach.
thanks!
On Wed, 2025-03-12 at 15:29 -0400, Todd Zullinger wrote:
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
You may be talking about different things. PS1 applies to the shell running in the terminal. It sounds like you're thinking of the terminal window's title, perhaps?
I assumed that was what the OP was talking about. If he meant the Shell prompt, perhaps he was unfamiliar with the usual terminology.
poc
On 3/12/25 15:03, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:29 -0400, Todd Zullinger wrote:
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
You may be talking about different things. PS1 applies to the shell running in the terminal. It sounds like you're thinking of the terminal window's title, perhaps?
I assumed that was what the OP was talking about. If he meant the Shell prompt, perhaps he was unfamiliar with the usual terminology.
-- How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$ --
His plaint was that the prompt fills the line; he seeks a shorter prompt.
:m
On Wed, 2025-03-12 at 15:39 -0700, Mike Wright wrote:
On 3/12/25 15:03, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:29 -0400, Todd Zullinger wrote:
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
You may be talking about different things. PS1 applies to the shell running in the terminal. It sounds like you're thinking of the terminal window's title, perhaps?
I assumed that was what the OP was talking about. If he meant the Shell prompt, perhaps he was unfamiliar with the usual terminology.
-- How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
His plaint was that the prompt fills the line; he seeks a shorter prompt.
My point was that the question is poorly phrased. It mentions "the display of the current path in the terminal window", when the actual issue has absolutely nothing to do with terminal windows. The exact same thing would happen in a virtual console or a glass teletype, since it's really about the Shell, not the particular display being used. My mistake for reading what the question said rather than what (in hindsight) it really meant.
poc
On 3/12/25 7:29 PM, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:39 -0700, Mike Wright wrote:
On 3/12/25 15:03, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:29 -0400, Todd Zullinger wrote:
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
You may be talking about different things. PS1 applies to the shell running in the terminal. It sounds like you're thinking of the terminal window's title, perhaps?
I assumed that was what the OP was talking about. If he meant the Shell prompt, perhaps he was unfamiliar with the usual terminology.
-- How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
His plaint was that the prompt fills the line; he seeks a shorter prompt.
My point was that the question is poorly phrased.
Story of my life and one of my wife's big complaints. Doesn't help being dyslexic and Mr. Malaprop.
It mentions "the display of the current path in the terminal window", when the actual issue has absolutely nothing to do with terminal windows. The exact same thing would happen in a virtual console or a glass teletype, since it's really about the Shell, not the particular display being used. My mistake for reading what the question said rather than what (in hindsight) it really meant.
I learn from these threads and HOPEFULLY remember for the next time. I DO make notes...
Thanks all!
Tim:
Depending on your terminal, you *may* be able to have the full path showing in the title bar, and just the current directory name at the command prompt.
Changing the \w to \W in your PS1= .bashrc string does it for some of them (just shows the last directory of the filepath).
By way of example, typing this into my command line let me change the current prompt without making permanent changes to my settings:
export PS1="[\u@\h \W]$ "
[username@hostname directory]$
Robert Moskowitz:
That is quite better than what I hand coded, as it tracks changes in the current directory.
Maybe to add coloration.
I deliberately left colouring out for a simple example, but I normally have this in my ~/.bashrc file:
export PS1="[\e[44m][\u@\h \w]$[\e[0m] "
Which gives me the full path, and colouring. If I change the \w to \W by typing this into the command line:
export PS1="[\e[44m][\u@\h \W]$[\e[0m] "
Then the command line changes to just the last directory name before the prompt, but my Mate terminal window title bar is still showing the full path.
I get the prompt prefix back-coloured blue, and the rest of the line goes back to normal. I do something similar for root, but have it back-coloured red. It makes it easier to see where a command line was written when scrolling back through a long output.
Of course typing all that would be a pain, so you could either play cut and paste games with .bashrc, or make it into an alias, or write a script. You could add the following to your ~/.bashrc under where it tells you to put user-specific aliases and functions:
alias short='export PS1="[\e[44m][\u@\h \W]$[\e[0m] "' alias long='export PS1="[\e[44m][\u@\h \w]$[\e[0m] "'
Now typing short or long into the command line sets prompt accordingly. I don't think those aliases are stomping on anything else that currently exists (at least they don't on my system).
Or, for the sake of a silly example, one could go mad, and colour the path different from other things in the prompt prefix:
PS1="[\e[44m][\u@\h [\e[45m]\w[\e[44m]]$[\e[0m] "
There's a lot of confusing-to-read escaping in there, because the square brackets have different meanings and are part of the ANSI colour codes, as well as where you see them just typed as brackets in the prompt. The ones that are just typed to show up as [ and ] around the prompt prefix are the [ before \u and the ] just before $
On Thu, 13 Mar 2025 at 00:16, Robert Moskowitz rgm@htt-consult.com wrote:
Doesn't help being dyslexic and Mr. Malaprop.
Malaprompt.
:-|
On 3/12/25 9:03 PM, Will McDonald wrote:
On Thu, 13 Mar 2025 at 00:16, Robert Moskowitz rgm@htt-consult.com wrote:
Doesn't help being dyslexic and Mr. Malaprop.Malaprompt.
:-|
That too!!
But it was no fun being up on the stage in front of some 500 attendees and my slides say one thing and my mouth says something else. Even when in my intro I warned them...
On Wed, Mar 12, 2025 at 3:38 PM Bob Marčan via users users@lists.fedoraproject.org wrote:
On Wed, 12 Mar 2025 12:09:21 -0400 "Robert Moskowitz" rgm@htt-consult.com wrote:
I don't want it permanent. this whole process is to deal with those specific times I am working on a project in a very deep directory.
I have a dozen terminal windows open right now in 5 workspaces; it is only 2 that are on this project (working on the scripts for draft-ietf-drip-dki-05).
Years ago I had the same issue (using zsh), so added a newline after the directory name.
$PS1='<long string>$' <long tring>$PS1='<long string>\n$' <long string> $
On Wed, 12 Mar 2025, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:39 -0700, Mike Wright wrote:
On 3/12/25 15:03, Patrick O'Callaghan wrote:
On Wed, 2025-03-12 at 15:29 -0400, Todd Zullinger wrote:
That doesn't apply in Konsole for one. Don't know if it applies in other terminal emulators.
You may be talking about different things. PS1 applies to the shell running in the terminal. It sounds like you're thinking of the terminal window's title, perhaps?
I assumed that was what the OP was talking about. If he meant the Shell prompt, perhaps he was unfamiliar with the usual terminology.
-- How might I turn off (or change) the display of the current path in a terminal window?
For example I have one terminal window with:
rgm@LX140e-3:~/data/htt/Projects/Critical/drafts/draft-ietf-drip-rid/dki-try2$
His plaint was that the prompt fills the line; he seeks a shorter prompt.
My point was that the question is poorly phrased. It mentions "the
No. It wasn't.
display of the current path in the terminal window", when the actual issue has absolutely nothing to do with terminal windows. The exact same thing would happen in a virtual console or a glass teletype, since it's really about the Shell, not the particular display being used. My mistake for reading what the question said rather than what (in hindsight) it really meant.
A careless reader might get ambiguity, but there was no reason to interpret OP's question as definitely being about the title at the top of the terminal window. OP complained that the directory name filled the line, not really a problem in the title. The line is also in the terminal window.
Others had not problem understanding the question.
A sensible definition of "terminal window" might exclude the frame generated by the window manager. In that case, there whould be no possible ambiguity.