Setting PS1


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Setting PS1
# 1  
Old 04-07-2012
Setting PS1

I have set PSI for my prompt using the following command:

Code:
  PS1="${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\u@\h:\[\033[00m\]\[\033[01;37m\]\w\a]\[\033[00m\] "

which produces

Code:
chrisd@pguk:~]

I want to include [ in the beginning but cannot understand the way to do this.

Also I want to show only the current directory, not the whole path from ~/
# 2  
Old 04-07-2012
Hi kristinu,

Try next one:
Code:
$ PS1="\[\033[01;37m\][\[\033[00m\]${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\u@\h:\[\033[00m\]\[\033[01;37m\]\W\a]\[\033[00m\] "

This User Gave Thanks to birei For This Post:
# 3  
Old 04-07-2012
Any idea how to get only the current directory to show.
# 4  
Old 04-07-2012
In my post \W shows only your current directory, but try yourself. Here a page with all secuences:

Bash Prompt HOWTO: Bash and Bash Prompts
# 5  
Old 04-07-2012
Missed that. Ok works.

---------- Post updated at 11:41 AM ---------- Previous update was at 11:11 AM ----------

Now I would like to have the title of the terminal window display the whole path.

Ok done it

Code:
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PS1 - change

Hello I am attempting to generate a bash scrip that prompts me at loggin to change my PS1 - However, I am running into an issue w/ the code. #!/bin/bash #the point of this script is to that it automates and changes my prompts every day msg1="What do you feel like adding today :" echo... (11 Replies)
Discussion started by: D'go
11 Replies

2. UNIX for Dummies Questions & Answers

Need to revert default prompt in Linux after setting PS1 command

I have given as: PS1="Karthick>" in linux. Now the prompt changed as: Karthick> Now I need to get back the default prompt . How to achieve this? Thanks in advance (13 Replies)
Discussion started by: karthick nath
13 Replies

3. UNIX for Dummies Questions & Answers

setting the PS1 variable

Hi i'm new to unix, can anyone assist in me setting the PS1 variable in unix (3 Replies)
Discussion started by: user@123
3 Replies

4. Solaris

problem in setting PS1 variable

Hi I have set PS1 in my profile as - PS1='${LOGNAME}@${PWD}>' ; export PS1 it works fine if I am in bash/ksh shell, but as soon as i switch to bourn shell (sh) then it shows "${LOGNAME}@${PWD}>" as prompt. It is also not working in csh. Please help. (3 Replies)
Discussion started by: sanjay1979
3 Replies

5. Shell Programming and Scripting

Help setting PS1 prompt to include current time

Hi, I'm using the ksh shell and I'd like to set my PS1 prompt on an AIX system to include, amongst ther things, the current time. This was my best effort: export PS1=$(date -u +%R)'${ME}:${PWD}# ' but this only sets the time to the value when PS1 is defined and the time value doesn't... (4 Replies)
Discussion started by: m223464
4 Replies

6. UNIX for Dummies Questions & Answers

PS1 prompt

please advise what's wrong with this command ? PS1="`hostname`:`who am i | cut -d " " -f1`:>>" trying to make the PS1 prompt look like : machine_name:username:>> thank you (4 Replies)
Discussion started by: venhart
4 Replies

7. Shell Programming and Scripting

To change PS1 for every one second

I want to change the PS1 prompt with current time. I want the PS1 to update for every one second. I write a Script. PS1='\T' but it updates after i press enter key.I want to update without pressing enter key. can any one help me? (0 Replies)
Discussion started by: lakshmananindia
0 Replies

8. UNIX for Dummies Questions & Answers

setting PS1 variable

Hi, I am trying to set my current prompt with the current directory iam working on by $PS1=$PWD but it is blank. please help. (4 Replies)
Discussion started by: papachi
4 Replies

9. UNIX for Dummies Questions & Answers

PS1 in ksh

I know this question has come up before but I couldn't find any documentation on ksh here. I'm trying PS1="`whoami`@`hostname`:`pwd`> " export PS1 in ksh but the working directory sticks at the home directory. How do I fix that? Also, how do I make the prompt bold in korn? (3 Replies)
Discussion started by: rein
3 Replies

10. UNIX for Dummies Questions & Answers

I changed PS1 and now ....

Hello I am using Debain Potato and I changed the PS1. When I log in locally everythink is fine, except that when I enter a long row without hitting enter, then it word wraps automatically. And it does it not at the end of the row, it does it in the middle of the row! It also does not writes... (7 Replies)
Discussion started by: Fwurm
7 Replies
Login or Register to Ask a Question