Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ps1]

PS1 is the environment variable in the Bourne shell and variants which specifies the command prompt.

154
votes
5answers
169k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something more ...
18
votes
3answers
13k views

Where can I find a complete reference for the $PS1 variable?

The default PS1 variable on my machine (Kubuntu 13.10) is this: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ I'm looking for a reference for how the $PS1 variable works that, at ...
6
votes
1answer
20k views

How can I change the prompt of the terminal permanently

How can I change prompt name seen at terminal? my prompt : <user_name>@<user_name>-MEGA-BOOK-VR320:~$ It is too long. I want to change it to: gcc : However, I should see the path ...
6
votes
2answers
985 views

Why aren't variables like $PS1 in printenv?

From what I can tell printenv displays environment variables, but why don't I see other variables like PS1 for customizing the shell prompt? What exactly is printenv outputting and why doesn't it ...
20
votes
4answers
26k views

Prepend current git branch in terminal [duplicate]

How can I configure the terminal to display the current git branch? I'd like to see the second line rather than the first: andy@bob:~/my_projects/project_x$ (master)~/my_projects/project_x$ I don'...
3
votes
1answer
92 views

Wrapping lines bugs when trying to colour terminal PS1 (even when escaping non printing caracters)

Since I've been issue while working too long without plugging my laptop in, I'm trying to write a new PS1 which show my current battery status using upower. I'm almost there, everything is working ...
10
votes
2answers
3k views

Why is my function not re-evaluated in PS1?

I'm trying to have a part of my prompt set dynamically by a function, so in my .bashrc I have: asdf () { echo -n $(pwd) } PS1="\u@\h:\w $(asdf)\$ " Opening a shell gives me what I expect at ...
5
votes
2answers
398 views

Reverse-search in CLI: messed up output afterwards [duplicate]

See my edit below, this is not totally a duplicate of Shell prompt customization and cmd behavior My reverse-search function in the CLI is broken and I don't know how to fix it back... When I hit ...
2
votes
1answer
8k views

“export PS1=” for customizing shell prompt

I wanted to customize my shell prompt to include the time. So, I did export PS1='\t\w\$'. My prompt now looks like 18:57:37~$. I don't know how to prepend it with username@hostname. Also, I don't ...
5
votes
1answer
7k views

How do I remove computer name from the command line prompt?

Is any way to remove my computer name from command line prompt? I want the prompt to look like this: kasiya:~$ Instead of this: kasiya@kasiya-pc:~$
4
votes
2answers
753 views

Shell prompt customization and cmd behavior

I want my prompt to display: current (absolute) working directory, colored in green and in a NEW line, the dollar sign and an empty space. I am using this line in .profile export PS1='\e[0;32m$(pwd)...
12
votes
6answers
4k views

What does the name after '@' at terminal prompt mean?

I noticed that when in terminal the prompt is generally in the format username@users: or I have even seen username@(none):. I get that the first part is the logged in person's user name, but what is ...
0
votes
0answers
37 views

Change Terminal 'user@host' colours - Gnome [duplicate]

I've pretty much got the terminal colour scheme I want, however the user@host colours stick out like a sore thumb, and really don't fit in with the scheme. See screenshot in link: How do I go about ...