Questions tagged [ps1]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

Using UTF-16 syntax to include Unicode characters in Bash prompt (PS1)?

There is an existing post on Unix & Linux about including Unicode characters in the Bash prompt, but the method it gives for using the UTF-16 code (syntax \uXXXX) doesn't work for me. Let's take ...
Artur Meinild's user avatar
1 vote
1 answer
149 views

Having trouble understanding basic variables and commands because of my understanding of the Linux environment [closed]

I'm having a hard time understanding some basic concepts about Linux. And the influence of some variables on those concepts. Those basic concepts are Virtuel environment, shell, tty. The variabele: $...
TheOriginalStinger's user avatar
0 votes
1 answer
190 views

PS1 string full documentation and reference page

After several frustrations I decided to share it so that next time I don't have to refer to my notebook but Google for it. Is there some definitive documentation for PS1 strings accepted values? ...
WesternGun's user avatar
0 votes
0 answers
87 views

Different behavior between non-root and root user using same PS1 env var

I have slightly different behaviors between non-root and root users on the PS1 bash prompt: ~/Documents/infra-code (homologazure)$ echo $PS1 \[\033[01;34m\]\w\[\033[00m\]$(parse_git_branch)\$ ~/...
lucasgrvarela's user avatar
0 votes
1 answer
615 views

how to create an alias which changes the bash prompt?

How can I make an alias along the lines of: command-line bash bashrc prompt ps1 alias=PS1="\d \h $ " which, obviously, won't work. Is there some trick to making assignments from the ....
Nicholas Saunders's user avatar
0 votes
1 answer
75 views

Change the username of in PS1 to any arbatrary strings temporally

I set my terminal prompt as: $ echo $PS1 ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]:\n$ It display as: me@alpha:/: How could change the username ...
Wizard's user avatar
  • 2,891
1 vote
1 answer
202 views

Setting a more interactive shell prompt [duplicate]

I went through the website for Tilix and came across a very beautiful shell prompt in one of the images on the website. I want to know if that is just for show(a gimmick) or is it actually possible to ...
akxer's user avatar
  • 2,036
5 votes
2 answers
4k views

Bash prompt display HH:MM:SS

I learned from the question date - HH:MM:SS (with AM/PM) 12 Hour Timestamp for Bash Prompt - Unix & Linux Stack Exchange and fine-tune my prompt as: export PS1='\D{%r}:\[\e]0;\u@\h: \w\a\]${...
Alice's user avatar
  • 1,700
5 votes
1 answer
7k 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\]$(...
janw's user avatar
  • 546
4 votes
1 answer
11k 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 ...
Struan's user avatar
  • 53
0 votes
1 answer
2k 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 ...
Kenenbek Arzymatov's user avatar
10 votes
2 answers
2k 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 ...
MrYoshiji's user avatar
  • 203
9 votes
1 answer
1k 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 ...
Rahul Bharadwaj's user avatar
5 votes
1 answer
971 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 ...
DrGorilla.eth's user avatar
3 votes
1 answer
252 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 ...
joker's user avatar
  • 423
5 votes
1 answer
53k 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 ...
Smile's user avatar
  • 1,099
3 votes
1 answer
449 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%} $...
dwayne's user avatar
  • 31
0 votes
1 answer
79 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.
Jagdish's user avatar
10 votes
2 answers
6k 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 ...
AJJ's user avatar
  • 862
2 votes
1 answer
243 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 ...
JinHyeonSa's user avatar
0 votes
0 answers
823 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 ...
luv.preet's user avatar
  • 5,787
3 votes
2 answers
330 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 ...
ssvegeta96's user avatar
0 votes
1 answer
239 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 ...
devklick's user avatar
  • 127
5 votes
2 answers
972 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)...
pkaramol's user avatar
  • 2,121
0 votes
0 answers
89 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 ...
devklick's user avatar
  • 127
0 votes
0 answers
83 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 ...
KonradDos's user avatar
  • 2,951
0 votes
0 answers
90 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 "::...
user avatar
2 votes
1 answer
5k 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 ...
user avatar
5 votes
2 answers
2k 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 ...
Byte Commander's user avatar
  • 107k
3 votes
1 answer
3k 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 ...
radistao's user avatar
  • 195
4 votes
3 answers
7k 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 $?
antonio8909's user avatar
3 votes
1 answer
465 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 ...
Programster's user avatar
  • 5,871
1 vote
2 answers
260 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 ...
LinuxSailorTech's user avatar
2 votes
1 answer
9k 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?)?
Mario Kamenjak's user avatar
1 vote
1 answer
152 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 ...
Rahul Mukherji's user avatar
0 votes
2 answers
446 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='${...
H2ONaCl's user avatar
  • 9,673
3 votes
2 answers
337 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>@< ...
KostasKol's user avatar
4 votes
1 answer
681 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;...
user avatar
26 votes
2 answers
8k 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 ...
darthbith's user avatar
  • 374
2 votes
2 answers
2k 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 ...
Sah's user avatar
  • 143
2 votes
2 answers
380 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@...
Frank's user avatar
  • 41
1 vote
1 answer
4k 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 #
aksub's user avatar
  • 53
10 votes
1 answer
11k 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: αғsнιη:~$ Instead of this: αғsнιη@αғsнιη-pc:~$
αғsнιη's user avatar
  • 35.7k
4 votes
1 answer
1k 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 ...
corvid's user avatar
  • 347
1 vote
1 answer
54 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 ...
Cbhihe's user avatar
  • 2,761
28 votes
3 answers
26k 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 ...
Mark Raymond's user avatar
0 votes
1 answer
112 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 ...
kdperspective's user avatar
3 votes
1 answer
12k 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?
user214877's user avatar
-1 votes
1 answer
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 ...
Leathan's user avatar
  • 135
8 votes
2 answers
11k 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\...
Neeraj Gangwar's user avatar