Setting PS1


 
Thread Tools Search this Thread
# 1  
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  
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  
Any idea how to get only the current directory to show.
# 4  
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  
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"'

 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Changing PS1

I have coded PS1 as shown, producing the following result when writing on the command line ┌─ cdl └──╼ make tracepdf2d If I make an error in the command an ✗ is printed ┌─ ✗ cdl └──╼ ls-a ls-a: command not found My problem is that if I just press enter, I do not want to have the... (3 Replies)
Discussion started by: kristinu
3 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. 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

7. 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

8. UNIX for Dummies Questions & Answers

PS1 problem

can anyone tell me how to change the $ prompt by calling a variable. Say for example i called a var 'enable' I and would like the $ prompt to change to a phrase like 'my prompt' any help would be great (1 Reply)
Discussion started by: pg080394
1 Replies

9. UNIX for Advanced & Expert Users

PS1 variable

I want to set my prompt to something more descriptive than a plain old $, so I set the PS1 variable as such: PS1="" Which changes the prompt correctly, but when I change directories, it does not update the prompt. So I tried this: PS1="`pwd`>" I get the same results when changing... (2 Replies)
Discussion started by: dangral
2 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

Featured Tech Videos