Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 06-08-2008, 09:38 AM   #1
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Debian Lenny AMD64
Posts: 506

Rep: Reputation: 32
Showing full path in Terminal.

Here I am again! Sorry, sorry! :-)

How can I show full path prompt in Terminal? Now, I always see bash-3.1$ as the prompt. I know I could use pwd to check where I am standing at a certain moment but it would be easier if I could always see the full path at the command prompt.

Thank you!

Glore 2002.-
Old 06-08-2008, 09:41 AM   #2
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You want to use the "\w" flag in your PS1 environment variable. For example, in my .bashrc I have

export PS1='\u@\h:\w\$ ',

where \u is for username, \h for hostname and \$ for the prompt symbol ($ for regular user, # for root). Edit: you may like to look at this.

Last edited by Nylex; 06-08-2008 at 09:44 AM.
Old 06-08-2008, 10:30 AM   #3
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Debian Lenny AMD64
Posts: 506

Original Poster
Rep: Reputation: 32
Thank Nylex!

Thanks Nylex for your help. I already changed my prompt with your explanation. Now, it looks much better and self explanatory.

Old 06-08-2008, 11:26 AM   #4
Senior Member
Registered: Sep 2005
Distribution: Slackware
Posts: 1,442

Rep: Reputation: 71
Personally, I like to add colors and newlines to mine so that they are more readable. For some I change the title bars as well.

You can also vary what you get depending upon what terminal you are using (screen session, xterm, std console, etc). Here's a snippet

case "$TERM" in
	# PROMPT_COMMAND Sets title.
	PROMPT_COMMAND='echo -ne "\033]0;$(date +%T) - ${USER}: ${PWD/$HOME/~}\007"'
	export PS1="\n[ \t ] \n\[\e[34;1m\]\u@\[\e[31;1m\]\H:\w\n\[\e[0m\]$> "
	PROMPT_COMMAND='echo -ne "\033]0;$(date +%T) - ${USER}: ${PWD/$HOME/~}\007"'
	export PS1="\nScreen Session: [ \t ]\n\[\e[34;1m\]\u@\[\e[31;1m\]\H:\w\n\[\e[0m\]$> "
	export PS1="\nPhil's Terminal Prefs \t\a\n\[\e[34;1m\]\u@\[\e[31;1m\]\H:\w\n\[\e[0m\]$> "
	# First section attempts to set title with "\n\[\e]2;"
	# Title ends at first '\n' after title escape sequence
	# If setting title not possible, then "\n\[\e]2" is ignored and the ';' is shown along with contents of title.
	# On some terminals the entire title section will be ignored.
	export PS1="\n\[\e]2;Phil's Terminal Prefs \t\n\[\e[34;1m\]\u@\[\e[31;1m\]\H:\w\n\[\e[0m\]$> "



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
hard drive showing as full but isn't msound Linux - General 1 07-30-2007 09:21 AM
AS 2.1 Not showing full ram rashid68 Linux - Server 4 07-13-2007 03:24 PM
Terminal showing whole path mattd7591 Linux - General 10 01-15-2007 09:37 AM
configuring terminal so not to show full path harshnoise SUSE / openSUSE 2 02-26-2005 07:42 AM
Showing Full Path In Konsole Verbal Kint Linux - General 2 04-08-2004 02:10 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration