Solved

changing  the prompt

Posted on 1998-11-22
10
234 Views
Last Modified: 2013-12-16
How can I change my '$'prompt to any other prompt.I heard that it is done by using .cshrc file.How to access it ?Give me a step by step method from the time of login.
0
Comment
Question by:kravella
10 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1812367
echo 'set prompt="any other prompt"' >> ~/.cshrc
man csh
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812368
You mentioned $ prompt - so are you using the Korn shell or Bourne shell?
0
 
LVL 84

Expert Comment

by:ozo
ID: 1812369
I asumed csh, since kravella asked about .cshrc,
But you're right, we should verify which shell is being used.
0
 

Author Comment

by:kravella
ID: 1812370
Adjusted points to 100
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812371
I was just wondering - the $ prompt is generally no the default one in C shell.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Accepted Solution

by:
pagladasu earned 100 total points
ID: 1812372
If you are using the Bourne or Korn shell, you could insert the following line in your
profile file
PS1=")-"
This would change the prompt in this shell

Thanks and all the best
pagladasu
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812373
Here's something that I use in my .profile file.
I am using Korn shell.

dasu(){
  cd $1
  PS1="`pwd`>"
}
alias cd=dasu
cd

0
 
LVL 2

Expert Comment

by:blowfish
ID: 1812374
to pagladasu:

The Korn shell variable, $PWD is set by ksh to be the current value of pwd.  You can verify this by "echo $PWD" from the shell prompt.  So, to set your prompt to be the current working directory in the Korn shell, without declaring an alias, you can use the following in your .profile;

export PS1="\$PWD>"

Cheers,  

--frankf
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 1812375
to frankf - righto, it works.
pagladasu

0
 

Expert Comment

by:saila
ID: 1812376
As the System prompt is held in variable PS1.

Edit either /etc/profile  - to define same prompt for all users or  .profile in home directory of a user

and define variable PS1, ie

PS1='$PWD) '
export PS1

This shows current dir (like dos prompt).
you have to export it to make it valid in sub-shells.

If you want to display hostname as well you can define something like :

HOST=$(hostname)    - Korn shell only OR
HOST=`hostname`
PS1='[$HOST] - $PWD > '
export PS1


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now