How to make urvxt display current directory? (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
JamesTheAwesomeDude
Posts: 99
Joined: Tue 29 Jan 2013, 17:17
Location: Classified

How to make urvxt display current directory? (Solved)

#1 Post by JamesTheAwesomeDude »

Back when I used Ubuntu (and even earlier, in Windows,) the console/terminal would display the current directory right behind the # sign. This was annoying at times, but overall much appreciated. Is there any way to get this working in urxvt?

I'd actually be perfectly fine with using a different Terminal program. So far, urxvt has been nothing but annoying. I just need another program that would work. At this point, I'd be ecstatic just to get LXTerm. :( (Pretty pathetic, huh?) With the clipboard annoyances, the difficulty in configuring it, and a few other things, I'd really like some sort of replacement.

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#2 Post by npierce »

First you should find the command currently used to set the PS1 prompt. You can do that with this command:

Code: Select all

grep "^PS1=" /etc/profile
To add the working directory to the prompt, you need to insert \w at the beginning of the value for PS1. You can try out your modified command in bash. For instance:

Code: Select all

PS1="\w # "
If you would prefer just the base name of the directory, and not the name of all of its ancestors, you can use a capital 'W', like this:

Code: Select all

PS1="\W # "
Here is an excerpt from a bash session that is an example of how to get the prompt to display the working directory:
# grep "^PS1=" /etc/profile
PS1="# "
# PS1="\w # "
~/my-documents #
~/my-documents # PS1="\W # "
my-documents #
When you have the prompt the way you like it, you can make it permanent by editing the command used in your /etc/profile file.
Last edited by npierce on Sun 10 Feb 2013, 21:37, edited 1 time in total.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#3 Post by 01micko »

Works just as well when inserted into ~/.bashrc :wink:
Puppy Linux Blog - contact me for access

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#4 Post by Semme »

Hi NPierce, as I'm sure James and I would prefer- how do we get Pup to honor this running LXTerminal?

If you know- great. If you don't, well.. you're still one of the :wink: better contributors on the forum. TIA..

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#5 Post by npierce »

I know nothing about LXTerminal, but PS1 is not terminal-specific; it is used by bash. I would expect it to work fine on any terminal. Try it. If it doesn't work for you, give a shout.

User avatar
JamesTheAwesomeDude
Posts: 99
Joined: Tue 29 Jan 2013, 17:17
Location: Classified

#6 Post by JamesTheAwesomeDude »

Yes! It worked! Inserting the command into ~/.bashrc got everything set up, and now it looks great!

Thank you all for your suggestions! :D

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#7 Post by npierce »

You're welcome.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: How to make urvxt display current directory?

#8 Post by L18L »

JamesTheAwesomeDude wrote:...the console/terminal would display the current directory right behind the # sign. ...

Code: Select all

pwd
just if needed: print working directory 8)

Post Reply