LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 06-08-2008, 09:38 AM   #1
glore2002
Member
 
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
Nylex
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
glore2002
Member
 
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.

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

Rep: Reputation: 70
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

Code:
case "$TERM" in
xterm*|rxvt*)
	# 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\]$> "
	;;
screen*)
	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\]$> "
	;;
linux*)
	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\]$> "
	;;
esac
 
  


Reply

Tags
bash


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/Novell 2 02-26-2005 07:42 AM
Showing Full Path In Konsole Verbal Kint Linux - General 2 04-08-2004 02:10 AM


All times are GMT -5. The time now is 02:14 AM.

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