The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to a prompt a particular value??? grajesh_955 Shell Programming and Scripting 2 03-11-2008 04:44 AM
OK prompt hshapiro SUN Solaris 3 10-04-2007 04:39 PM
prompt within awk gefa Shell Programming and Scripting 7 03-08-2007 01:44 AM
set prompt in sh yls177 UNIX for Dummies Questions & Answers 14 03-25-2003 08:36 PM
set prompt in sun inquirer UNIX Desktop for Dummies Questions & Answers 2 07-10-2002 08:17 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-30-2001
Registered User
 

Join Date: Jun 2001
Posts: 10
prompt

how do we change the command prompt? right now my prompt says

felix%

where felix is the machine i´m on. but how do we change it? for example, how can i make it say
me%

and how do we get it to tell us what directory we are under because when i change into a subdir then the prompt doesn´t change to include the subdir the way that dos works under windows.

thanks
Forum Sponsor
  #2  
Old 06-30-2001
Registered User
 

Join Date: Jun 2001
Location: Leicestershire, UK
Posts: 92
The prompt for bash shells can be changed by altering the PS1 variable.

PS1 can be declared in the global /etc/bashrc file or in ~/.bashrc.

My shell prompt looks like the following


[Sat Jun 30 15:32 andy@prosentia andy]>

The PS1 variable in my ~/.bashrc file looks like the following
PS1="[\d \t \u@\h \W]>"


\d is date
\t time
\u user
@\h @hostname
\W basename for current directory

the bash man file has details on different flags to alter the prompt

if your current directory was /usr/bin

PS1="me \W>" would show: me bin>

PS1="me \w>" would show: me /usr/bin>

Andy Hibbins
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0