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 [prompt]

A string of characters displayed by interactive shells to signal the shell is waiting a user input.

2
votes
1answer
25 views

What does the leading part of Bash's default PS1 in Ubuntu mean?

This is the $PS1 of my Bash shell on a freshly installed Ubuntu 18.04: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \$ I can ...
6
votes
2answers
715 views

How to produce a PS1 prompt in bash or ksh93 similar to tcsh

In tcsh, I have the default: prompt [%m:%c3] %n%# which gives prompts like: [woehler:hacking/c/hello] ajcarr% and [woehler:~] ajcarr% In other words, the current directory and up to the next ...
1
vote
2answers
37 views

How do you make a custom prompt? [on hold]

I would love help on making a prompt, I know how to make commands, but I want to make something like: V-PROMPT:> I know I could just do read -p 'V-PROMPT:>' but I want to be able to put ...
1
vote
1answer
19 views

Conditional powerlevel9k prompt

I want to de-activate my right prompt when the tmux terminal pane gets small. Is there an easy way to conditionally render the RPROMPT variable based on screen width?
0
votes
2answers
50 views

How to retrieve prompt format string in csh / tcsh

My current prompt format string is generated by an outside script that is provided by the organization. I want to manipulate it a bit (add time to the string) for that I need my current format string. ...
0
votes
0answers
27 views

Line wrap broken after using PS1

The line wrap is working weirdly when I use the following PS1: export PS1="\[\033[00;32m\][\d \T] \[\033[0;31m\]\u@\H:\[\033[0;37m\]\w\[$(tput sgr0)\] \n\[\033[0m\]$ " It is line wrapping onto the ...
3
votes
1answer
70 views

Where is the PS1 prompt variable set in ash shell?

I have a NAS drive from Western Digital. I can ssh into it, and when I log in, the first line that appears is: BusyBox v1.20.2 (2014-10-30 15:28:59 CST) built-in shell (ash) I don't like the default ...
6
votes
2answers
95 views

Emit zero-width bash prompt sequence from external binary

In bash, how do I encode zero-width sequences into PS1, when those sequences are coming from stdout of an external process or function? How do I implement writes-prompt-sequences-to-stdout so that it ...
0
votes
1answer
25 views

How to prompt data on piped commands [duplicate]

I'm trying to use this command: mysqldump --opt --hex-blob \ -h source -p xxxx -u user1 \ source_db | \ mysql \ -h target -p yyyy -u user2 \ target_db So, how can I rewrite it to ...
2
votes
2answers
110 views

Prompt to reflect sshfs mountpoint?

I use sshfs to remotely mount a remote folder to my local machine, the problem is that I need a way to know that I'm working under remote folder on local machine OR local folder to avoid accidentally ...
-2
votes
1answer
40 views

Cat activates mystery prompt [duplicate]

My cat stepped on the keyboard today and the resulting garbage caused a ">" prompt to appear. The text was something like "~~~~~~~~~~~~~~~~YYYY~~~~~~~~~~~ ]]]]]]]]". I could not get the prompt ...
1
vote
1answer
32 views

Automatically returning after a command

I'd like to have return pressed twice after I run a command to make the terminal easier to read. [root@localhost ~]# fdisk -l /dev/sda1 Disk /dev/sda1: 1 GiB, 1073741824 bytes, 2097152 sectors Units: ...
0
votes
2answers
101 views

su - user not landing in users home directory

One one system when I run su - otrs the returned prompt looks like this: [root@some_server admin_app2]# su - otrs Last login: Thu Jan 31 10:47:37 CET 2019 on pts/0 [otrs@some_server ~]$ On another: ...
-1
votes
1answer
36 views

Changing the prompt in Ubuntu

The line that I type in on Ubuntu looks like this: username@DESKTOP-FOO:~$ when I want it to look like this: username@userPC:~$ How do I fix it?
0
votes
0answers
91 views

Zsh Prompt Alignment Issues

Below is my zsh prompt configuration. Within Emacs (eterm) and Intellij terminals the display is compromised. Below is a representation of the display. % |...
2
votes
1answer
99 views

PS1 or PROMPT refusing to change in zsh

I enter in zsh: % PS1=">>> " But for some reason, the prompt is still the same: % echo $PS1 %B%F{red}%(?..%? )%f%b%B%F{blue}%n%f%b@%m %B%40<..<%~%<< %b%# Same thing with ...
2
votes
0answers
57 views

How can I properly use an American flag emoji in my bash prompt?

I want to use an American flag emoji in my bash prompt (i.e. PS1 environment variable). However, the American flag emoji causes the terminal cursor to offset an extra character to the right. 🇺🇸 is ...
1
vote
1answer
76 views

How to display ls --color=auto in prompt same as outside of it

When I put $(ls --color=auto) at the beginning of my PS1 it displays all in white and every filename in newlines. But when I call ls --color=auto, it displays in colors and separated by double spaces. ...
1
vote
0answers
26 views

text in text editors gets scrambled after defining set_prompt

I've set set_prompt to print prompt always on a new line. set_prompt() { local curpos stty -echo while read -t 0; do :; done echo -en "\033[6n" IFS=';' read -s -d R -a curpos stty ...
0
votes
2answers
43 views

Why does zsh list my prompt incorrectly on OS X?

I'm trying to figure out why zsh's prompt looks like this: (in text form): \[\]\u\[\] at \[\]\h\[\] in \[\]\w\[\]$(__git_ps1) \[\]$(git_diff)\n\[\]($(date +'1:MikesMBP.local ')) \[\]$\[\] I'd like ...
1
vote
1answer
219 views

Bash prompt getting garbled when I browse history?

I have MacOS and .bash_profile content: export PS1="\[\e[0;31m$\]\[\e[m\] \[\e[0;32m\w\e[m\] : \]" as a result I have pwd printed in terminal like this: but when I press up and down arrows to use ...
6
votes
1answer
82 views

What do these sequences mean in the PS1 variable? [duplicate]

I have trouble understanding what \[\e]0;$PWD\007\] and \[\e(0\]b\[\e(B\] mean. I am setting up my prompt on MobaXterm on Windows and those two sequences were in the default one. They were at the very ...
0
votes
2answers
90 views

Shorten very long dir name in bash prompt

How to get from this prompt ~/this/is/a-very-very-long-directory-name/dir to this ~/this/is/a-ver...name/dir in a bash prompt? So shorten directory names longer than nn (20+) characters to ...
3
votes
2answers
367 views

Send a notification or alert when bash asks for input from user

I am using Ubuntu 16.04 LTS. There is an alias in my .bashrc which uses notify-send: alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -...
0
votes
1answer
76 views

Bash prompt configuration

I've recently switched to Parrot linux and I'm very happy with it, but there's just one thing, this default fancy bash prompt is really ugly. I used zsh before, and for some reasons I want to go back ...
2
votes
1answer
30 views

Prevent print -P from substituting environment variable

I am using prompt pure as my prompt in zsh. Internally it uses print -Pn ... to print out the current directory. For some reason, if I have an environment variable set that matches the beginning of ...
0
votes
0answers
19 views

Corrupt prompt display after customizing it [duplicate]

I'm using GNU bash, version 4.4.23(1)-release and customized my prompt-look in ~/.bashrc via PS1="\e[0;36m\\u:\e[m\e[0;32m\\w\e[m $ " This gives me following look, including a lengthy command passed ...
2
votes
1answer
116 views

Show time elapsed since I started last command in prompt

Is there a way to show time elapsed since I started last command? I found this: PS1 prompt to show elapsed time but that will show time elapsed since last command finished until the new command ...
1
vote
1answer
78 views

Customize zsh prompt to separately show tail of current working dir

So my current prompt looks like this: ~/path/to/dir % If possible, I'd like it to show the topmost dir separately, like this: ~/path/to (dir) % I've gotten close! In my .zshrc, I currently have: ...
0
votes
1answer
64 views

Why does my custom bash prompt glitch when browsing the history [duplicate]

I have set up a custom bash prompt so I can see stuff like the current git branch, npm package version info, the virtual env I'm in, etc. However, when i press the up arrow key to browse the history, ...
0
votes
1answer
55 views

What is this random name in my command-line prompt? [duplicate]

I'm trying to figure out what this (obretschlt2-w7) is, from my command-line prompt. I'm using a conda environment, with the name µ_env, with my Username mu. However I can't figure out where the 2nd ...
3
votes
1answer
119 views

Bash prompt wrap broken when path has unicode (Greek) characters

When a path is too long to fit on the terminal and it wraps, the following prompt is broken and you can't see properly what is typed. See screenshot below: These are the contents of .bashrc that set ...
0
votes
1answer
37 views

prompt (PS1) doesn't update on bound command

I don't understand why these two different ways to use the same command lead to different behaviors. I've installed fzf and fd and have the following lines in .bashrc function updir(){ cd .. } ...
0
votes
2answers
32 views

Copy/paste doesn't work properly when changing prompt colors

Open a prompt, try to do this: type this code: export PS1="\e[1;30m-30-\e[m >" copy it with your mouse (select the code + copy it (I have auto-copy when I select with the mouse enabled)) close the ...
0
votes
2answers
132 views

BASH: how can I save the exit code in PS1 in order to use it later in PS1?

I am attempting to customize my PS1, in the following way (I have removed the colours): PS1='\u@\h:\w$(git_branch)$(useExitCode)\$ ' where git_branch() { git branch 2> /dev/null | sed -e '/^[...
1
vote
1answer
64 views

ZSH Prompt printing '[m' instead of '%'

I added a battery function to my vim statusline here's a link. It displays my battery correctly in vim and if I run $ acpi | grep -oP "(\d+)%" it returns some number followed by the percent sign (as ...
0
votes
1answer
91 views

How to set shell prompt?

My shell prompt appears to have changed. I am not sure what I did to cause it. How it appears now: bash-4.2$ How I want it to appear: robinhood@ubuntu$
0
votes
1answer
33 views

Line wrap broken when PS1 contains a newline

I recently started using linux and thought it would be useful to be able to see the working directory (not just the basename) so changed the ~/.bashrc file to this: # # ~/.bashrc # # If not running ...
4
votes
1answer
334 views

A status bar at bottom of terminal in place of PS1

It occurred to me that when I'm doing stuff in the terminal my PS1 is repeated several times for each command. My PS1 includes CWD and git branch so it can get reasonably long. Is there a way I can ...
3
votes
1answer
495 views

How do I modify my conda env variable in my terminal prompt?

I would like to customize my terminal prompt. Normally when a conda environment is activated the name of the environment is prepended to the PS1 string. I would like to customize this a bit more but ...
1
vote
2answers
331 views

Changing the color of git branch output?

In my .bash_profile I have a parse_git_branch function from the internet, and a PS1 to color some of my output. If possible, I would like to make my git branch name colored red, instead of white. ...
1
vote
2answers
531 views

Set last command exit code to bash prompt

I am running Ubuntu 18.04, and I would like to set my bash prompt so it reads like below: user:~/Documents [14:22:07] 1 $ My PS1 is as follows: ALERT_COLOR="$(tput setaf 1)" # Display unsuccessful ...
0
votes
1answer
38 views

Can I configure my .bashrc to highlight the fact that I'm in a Prod directory?

Currently, I'm using the following: export CLICOLOR=1 export PROMPT_DIRTRIM=6 PS1='${debian_chroot:+($debian_chroot)}\[\e[0;31m\]\u\[\e[m\]@\ [\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\...
0
votes
2answers
486 views

Color codes in bash $PS1 not working in tmux

I have a colorized prompt set up in my .bash_profile: export PS1="\[\033[0:33m\]testprompt@\h\[\033[00m\] " Outside of tmux I get a colored prompt reading testprompt@hostname. Inside a tmux ...
0
votes
1answer
74 views

Ignore PS1 for “Use Bright Colors for bold text” setting

I'm on a Mac using iTerm2. There is a setting called Draw bold text in bright colors; the problem with this setting is that it also affects my PS1 text. Is there a way to do it for everything except ...
0
votes
1answer
26 views

Show/hide history index in console

Via Putty, i log onto a SuSe linux machine. Suddenly, a percentage value appeared behind the commandline. Looks like that: [<DOMAIN>\<USER>@<HOST>:/home] 544% It seems the value ...
0
votes
1answer
41 views

Multi-line commands are messed up in my PS1

declare __host='\[\e[30;102m\] \h \[\e[0m\]'; declare __dir='\[\e[1;97;44m\] \w \[\e[22m\]'; declare __arrow='\[\e[1m\]▸ \[\e[0m\]'; function __git_status() { local info; info=$(__git_info) &&...
0
votes
1answer
177 views

/etc/bashrc overrides my settings in home .bashrc

i have the following code for my prompt in .bashrc in home dir: PS1_TIME='\033[01;31m\]\t \033[01;32m\]' PS1_USERNAME='\[\e[1;36m\]\u\e[1;37m\]@\e[1;32m\]\h\[\033[00m\]' PS1_LOCATION='\[\033[01;34m\]\...
1
vote
1answer
222 views

Bash behaves weird when PS1 contains wide unicode characters

I'm trying to customize the bash prompt and here is my PROMPT_COMMAND prompt_command() { local time="${BLUE}\t${RESET}" local user="${GREEN}\u${RESET}" local hostname="${GREEN}\H${RESET}" ...
1
vote
2answers
60 views

Process prompt directives inside $psvar without PROMPT_SUBST

I'm using precmd to generate a coloured git status in my prompt. I generate a sting like %F{green}master%f%F{red}%f, and assign it to $psvar[1]. My prompt includes %1v to display the text. However, ...