How to change prompt


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to change prompt
# 1  
Old 04-23-2008
How to change prompt

I have a Sun OS and at the moment the prompt is # and i want to change it to:

root@server #

can you help me please. thanks in advance.
# 2  
Old 04-23-2008
Depends somewhat on the shell. In Bourne-compatible shells, the variable PS1 determines the primary prompt. There's also PS2 and PS4 (sic) for secondary and tertiary prompts. See the manual page for your shell for more information.

Code:
PS1='root@server # '

The secondary prompt is what you see when you leave a quote open and continue on the next line. It is usually set to "> " by default.

Code:
# echo "hello
> world"

If your shell is csh or tcsh, those are not Bourne-compatible (but have a manual page, too).
# 3  
Old 04-28-2008
To avoid the need to repeat era's notation each time you logon.
Add similar to your .profile (if Sun OS uses a .profile) ... I use ksh on HP-UX.
Code:
export PS1='
['`uname -n`':${PWD}]
$ '

Which looks like the following when I logon ...
Code:
[mdirect:/home/cameron]
$

# 4  
Old 04-28-2008
Maybe try this !

Quote:
Originally Posted by drogram
I have a Sun OS and at the moment the prompt is # and i want to change it to:

root@server #

can you help me please. thanks in advance.

Hello,

PS1=`whoami`@`hostname`:\${PWD}\>

causes a promt like :

user@host:current.working.dir>

Regards
# 5  
Old 04-28-2008
Hi.

As era wrote, it depends on the shell. Here is an article that tells you how to change the prompt in most shells, including color, etc. I usually make the prompt red for root to reinforce the idea that I'm in a powerful situation ... cheers, drl

HOWTO: Change your Shell Prompt
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to Change the % prompt to - prompt in UNIX?

how to Change the % prompt to - prompt in unix :wall: ---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ---------- How To display the last modification time of any file in unix ---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM... (2 Replies)
Discussion started by: manjiri sawant
2 Replies

2. Shell Programming and Scripting

how to change unix cmd display prompt?

I am new to to unix and I want to make my own basic shell. What is the code I can use to change the unix cmd console display? For example my unix display prompt says MyCompterName~, I want it to say WhatEverMan~ (3 Replies)
Discussion started by: megaearth77
3 Replies

3. Red Hat

How to change password prompt for Kerberos?

Hello, I installed Kerberos on Red Hat. My testing tool checks for the prompt when user log-in. Unfortunately I don't have access to that testing tool so I have to fix somehow the prompt. My testing tool expects this format: login: XYZ Password: When I installed Kerberos I have this format:... (1 Reply)
Discussion started by: susja
1 Replies

4. UNIX for Advanced & Expert Users

Change password prompt format

Hello, I installed Kerberos on Red Hat. My testing tool checks for the prompt when user log-in. Unfortunately I don't have access to that testing tool so I have to fix somehow the prompt. My testing tool expects this format: login: XYZ Password: When I installed Kerberos I have this format:... (1 Reply)
Discussion started by: susja
1 Replies

5. Shell Programming and Scripting

How can i change my bash prompt ?

It looks like, user@hostname:/auto/home3/user$ Desired, user@hostname$ I added following line in .bashrc, but still its same. export PS1=" $ " Please help me :confused: (13 Replies)
Discussion started by: admax
13 Replies

6. UNIX for Dummies Questions & Answers

Where to change the UNIX password prompt?

Hi guys, I got these 3 servers: a, b and c which I ssh from a to b/c. a:$ ssh userid@b Password: a:$ ssh userid@c userid@c's password: Notice that the password prompt is different (highlighted in bold) on both servers even though their SUN Solaris version the same, OpenSSH version... (0 Replies)
Discussion started by: DrivesMeCrazy
0 Replies

7. UNIX for Dummies Questions & Answers

Change root prompt (Solaris)

Hello all. I was wondering if there is a way to change the root prompt. I am using Solaris 10 and would like to have the root prompt display the current directory along with 'SU' to indicate root status. What I have tried so far: /etc/passwd changed the root shell to korn with... (10 Replies)
Discussion started by: RobertSubnet
10 Replies

8. AIX

how to change the font size of shell in $ prompt

Can any help me to change the default font type and its size.. To clear more about my question.. Once i login to my unix domain... the font it displaying is of small size... all my shell commands i am executing in $ prompt also carries the same style(ls, date and echo...) i searched whole... (2 Replies)
Discussion started by: tsjpraveen
2 Replies

9. Solaris

How to change the system prompt and BG of terminal?

Hi all, I was wondering how to change the PS1 to my liking? I tried changing it using PS1='my choice' it worked but the subsequent terminals i open will not have it as the default PS1 ,how do i change it? also i am running as super user, and i need to exec bash, to get the bash environment...... (4 Replies)
Discussion started by: wrapster
4 Replies

10. Shell Programming and Scripting

script to change shell and prompt

I want to write a shell script which will change the current shell (say from csh to bsh) and my Prompt (say my name) as desired.pls help (1 Reply)
Discussion started by: SHYAM
1 Replies
Login or Register to Ask a Question