LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-05-2003, 09:46 AM   #1
hey_joe
LQ Newbie
 
Registered: Oct 2003
Location: England
Distribution: Red Hat Fedora 7
Posts: 13

Rep: Reputation: 0
Setting My Working Directory Environment


Hi,

I recently installed Red Hat 9 on my PC and I want to set my environment up so I can see what directory I'm in every time I log in or execute a command at my shell prompt. At the moment the information I've found to do this just leaves me showing my home directory whatever place I'm at.
 
Old 11-05-2003, 10:26 AM   #2
spurious
Member
 
Registered: Apr 2003
Location: Vancouver, BC
Distribution: Slackware, Ubuntu
Posts: 558

Rep: Reputation: 31
You insert the following line in your ~/.bash_profile (or in some distros, ~/.bashrc):

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

PS1 is the prompt environment variable. \u is the code for username. \h is the code for the hostname. \w is your current working directory. \$ is your prompt character. The '@' and the space after \$ will appear literally.

I usually insert the newline code, \n, because I like to have the prompt on a separate line than my commands. ie. PS1='\u@\h:\w\n\$ '

You can also set PS1 manually from the command prompt, but you have to do this everytime you log into a console shell.
 
  


Reply


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
environment setting problem nileshbirari Linux - Newbie 8 04-06-2006 07:14 AM
Need help setting environment variables. cottonmouth Linux - Newbie 3 12-09-2004 05:54 PM
edit path environment variable to include current working directory alb1954 Linux - Newbie 8 07-12-2004 12:26 AM
Setting an environment variable kharris Linux - General 3 10-02-2003 05:38 PM
setting environment variables rezza Linux - Distributions 2 04-09-2003 09:21 AM


All times are GMT -5. The time now is 02:39 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration