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.

1
vote
1answer
135 views

__git_ps1 not found but does exist

~/.bash_aliases where I set PS1, and is included in ~/.bashrc (the default settings) # color PS1 PS1="\[\033[01;90m\]\D{%H:%M} \[\033[01;33m\]Ubuntu\[\033[00m\] \[\033[01;34m\]\w\[\033[01;35m\]$(...
2
votes
1answer
103 views

What does a hash sign (#) at the end of the directory path in a Bash prompt mean? [duplicate]

I was in the middle of installing updates for Ubuntu when I came across an error, which allowed me to "Start a new shell to examine the situation". Doing so placed me at the top of my directory ...
0
votes
1answer
135 views

Get rid of name and hostname in a terminal prompt

I use powerline-shell and my prompt looks like: . How can I get rid of my name and hostname in the prompt? I tried to search in .bashrc file for PS1 variables: if [ "$color_prompt" = yes ]; then ...
5
votes
2answers
377 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 ...
9
votes
1answer
850 views

Change colour of a specific letter in the username in bash's PS1

I want to change the colour of a specific letter in my username being displayed by PS1 in bash. Eg: If my \u is rahul, I would like the letter h to be in blue colour and rest to be white. I do know ...
3
votes
1answer
83 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 ...
3
votes
1answer
164 views

Where is the timestamp in this script that sets the prompt?

I came across this old post, which I find useful. Now, I'm trying hard, but in vain, to tell which part of it is responsible for printing the timestamp at the end of the dashes. The following is the ...
2
votes
1answer
7k 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 ...
3
votes
1answer
111 views

Error while trying to post $PS1 on my terminal

I have tried to echo $PS1 on my terminal to find out the [u@h W] this is the error I get. echo $PS1 %{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $...
0
votes
1answer
49 views

My ubuntu terminal is opening as “gdhobe@vfroot-Thinkpad-T440:~$” I want to open it as “vfroot-Thinkpad-T440:~$” [duplicate]

My ubuntu terminal is opening as "gdhobe@vfroot-Thinkpad-T440:~$" I want to open it as "vfroot-Thinkpad-T440:~$" Usually terminal opens as vfroot-Thinkpad-T440:~$ How this issue could be solved.
6
votes
2answers
929 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 ...
2
votes
1answer
84 views

Effect of quotes when setting PS1

I'm using Ubuntu 16.04 LTS. I have a question for setting PS1 and using single quotation marks. I have been practicing to change a prompt. So, I have followed an example in the book, then I'm faced a ...
0
votes
0answers
313 views

Logging in as root with sudo shows strange prompt

When I log in as root, luvpreet@DHARI-Inspiron-3542:/$ sudo su I am getting something like this: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ What does this mean and why am I ...
1
vote
2answers
225 views

What kind of terminal type or PS1 custamization is this?

The person in the k8s tutorial video from Ubuntu is using a cool looking shell prompt. I cant tell if its a terminal emulator doing this or a custom $PS1 variable or maybe its like byobu. Any one want ...
0
votes
1answer
117 views

Customise Bash Terminal Font Colours

A short while ago I asked this question, on how to customise the bash terminal font colours. The question was answered and I got the colours wanting, using the link provided by a helpful user. The ...
4
votes
2answers
750 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)...
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 ...
0
votes
0answers
52 views

Conservative configuration of the PS1 variable

I need to create global variable environment PS1='[\u@\h ttyid:\l \d \t \W]\$ '? I used command $ export PS1 $ PS1='[\u@\h ttyid:\l \d \t \W]\$ ' Is that correct? After that A conservative ...
0
votes
0answers
60 views

How to put cursor between PS1 characters?

I'd like to put the insertion cursor of bash inside the PS1 variable: export PS1='\u@\h:<cursor here>:\w' Where the colons are included in the prompt (typing enter should result in a string "::...
2
votes
1answer
2k views

How to change the font size of just the prompt in bash?

I would like to be able to identify the prompt (username@PCname) easily in a bunch of text. I know the color of it can be changed and also the prompt can be edited to show what we want. But how do I ...
3
votes
2answers
525 views

See whether sudo mode is on (password is cached) on the command-line prompt

I want to know whether it is possible to indicate on the command-line (ideally in the prompt), whether sudo mode is on. By sudo mode I mean that I have already entered my password correctly once in ...
2
votes
1answer
1k views

Show other command line prompt in Midnight Commander (mc)

Is it possible to have different command line prompt in pure bash and mc? So, sometime i have mc started, but but panels switched off (Ctrl+O), and when i return back to the terminal after some period ...
1
vote
3answers
2k views

Replace $ in terminal prompt with user@host when using SSH [duplicate]

I'm using Ubuntu Server over SSH, and I see $ instead of the name of the user (let's say test@desktop, for example). How can I make the terminal display test@desktop instead of $?
1
vote
0answers
124 views

Byobu - dont show path

I have added the following code to my .bashrc file so that I do not see the path in my terminal. # Programster Injection # Here we can choose the mode for displaying the current path in bash ...
1
vote
2answers
157 views

Problems embedding a command in Bash PS1

Hi all I am having problems trying to embed this command in my bash prompt so that it will update itself each time the prompt is shown. I would like it to be part of the prompt itself free -m | tr -s ...
1
vote
1answer
5k views

Terminal: Change the color of my hostname and username

When using the terminal, I want both my username and my hostname to have separate color schemes. Is that possible with Ubuntu's default terminal emulator(if not, is it possible in terminator?)?
1
vote
1answer
62 views

Is there any way to create a custom PS1 for particular terminal profile

Since I find the custom terminal a bit bland, I like using the PS1 variable to make it more informative, and use a background image and custom text colours. I like the profile functionality, so I have ...
0
votes
2answers
198 views

Is .bashrc correctly setting the graphical terminal title?

From the default .bashrc is this: if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${...
4
votes
2answers
292 views

How to personalize the command prompt?

I just recently (re)installed Ubuntu on my pc and I have a slight "problem". I can't figure out what commands (?) I should write in my bash_profile, to have the following result: < User>@< ...
4
votes
1answer
523 views

How to clear PS1's formatting in gnome-terminal?

I have configured gnome-terminal in .bashrc to have custom colours: PS1='${debian_chroot:+($debian_chroot)}\[\033[00;37m\][\[\033[00;32m\]\t\[\033[00;37m\]] \[\033[01;34m\]\u\[\033[00;37m\]@\[\033[01;...
9
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 ...
2
votes
2answers
1k views

What is the best practice of customizing the Bash prompt (aka the PS1 environment variable)?

I am trying to add Git branch name to my Bash prompt by changing the PS1 variable like this: PS1=`echo "$PS1" | sed 's/\\\\\$ $/\$(__git_ps1)\\\\\$ /'` And if I understand correctly, it is not ...
2
votes
2answers
78 views

Is it possible to modify the prompt according to the existence of a VPN connection?

When away from home, I like to connect to the internet via VPN. It would be great to see whether the connection is on in my prompt, for example: frank@mycomputer ~ # without vpn active frank@...
1
vote
1answer
1k views

In the command line prompt, how do I show the full home path instead of the tilde (~)? [closed]

In the terminal prompt, how do I get to see the full path of the home directory? That is, from root@pcname:~ # to root@pcname:/home/username #
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:~$
3
votes
1answer
685 views

display only the git root directory if it is a git directory in PS1

I know you can do something like this for the PS1: Corvid @ ~/github/gitdirectory (master) $ but, this might be a bit odd: I want to only show the basename of the git directory, no matter where I am ...
1
vote
1answer
51 views

where does the discrepancy between \# in PS1 and n in !n come from?

Something has been gnawing at me for a while now and I can't seem to find a relevant answer either in man pages or using your 'Don't be evil' search engine. My .bashrc has the following: shopt -s ...
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 ...
0
votes
1answer
60 views

PS1 set to display Desktop

How do I set my default PS1 to ~/Desktop? I have tried changing it in my ~/.bashrc but to no avail. Can someone give out a detailed solution to be able to make changes to PS1 to the directory we ...
1
vote
1answer
8k views

how to make ps1 display full path name

using ubuntu 12.04.3, i've modified my PS1 to [\u@\h ]\w$ which SHOULD display as follows: [user@host /home/user]$ but it doesn't it's still [user@host ~]$ this used to work. what changed?
-1
votes
1answer
2k views

How to FULLY change the color of the terminal prompt

I've changed ~/.bashrc file of root and my own account. The problem is (maybe because of my encypted home directory): when I log in to my normal account: no color, when I log in as root: color! But ...
2
votes
1answer
3k views

How to keep the coloring in bash when using `sudo -i`?

I have changed PS1 variable in /etc/bash.bashrc to PS1="\n\[\033[0;37m\]\342\224\214\342\224\200\$(if [[ \$? == 0 ]]; then echo \"[\[\033[0;32m\]\[\033[01;32m\]\342\234\223\[\033[0;37m\]]\342\224\200\...
2
votes
3answers
692 views

Command line prompt looks strange in virtual console

In a terminal emulator like xterm my prompt looks like this: [august@macmini ~]$ but in a virtual console the string ;linux is prepended to the prompt to make it look like this: ;linux[august@...
4
votes
1answer
644 views

How can I set a different .bashrc PS1 depending on the directory I'm in?

I have the git-prompt.sh script setup in my .bashrc file which gives me the useful git information in my prompt. This is great for small repos, but when I cd into a large repo, it can take a 30+ ...
13
votes
3answers
12k views

Long lines overlap in Bash PS1 customized prompt

I have configured a fancy two-line PS1 bash prompt, with server name, time, user name and other useful variables. PS1="\n\[\033[1;34m\]\342\226\210\342\226\210 \u @ $SERVER_NAME""$BBlue"" \w""$...
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'...
6
votes
1answer
19k 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 ...
154
votes
5answers
166k 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 ...
2
votes
3answers
9k views

Emulator PCSX Reloaded - Fullscreen not working on Unity

I have an older PS1 console with a couple of games I bought some years ago. On my pc, I'm using PCSX Reloaded - the best PS1 emulators for Linux I found so far. But I'm having a little issue on ...
16
votes
1answer
5k views

PS1 problem, messing up CLI

I did a simple PS1 assignment PS1="\e[0;31m[\W]\$ \e[m " All I wanted to do was to change the prompt color and display only the relative path. However this messes up the CLI. For example, when ...