Stack Exchange Network

Stack Exchange network consists of 174 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.

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 ...
0
votes
0answers
8 views

How do I add the parent directory to the command prompt(Mac Terminal)? [duplicate]

I am trying to customize my command prompt in the Mac Terminal by adding the parent directory to it. For example, if I cd to my Desktop my command prompt would read, Directory: Desktop, Parent ...
2
votes
1answer
34 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
18 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
29 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
47 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
60 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
26 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
29 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
48 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 '/^[...
0
votes
0answers
22 views

Is it possible to display PS2 prompt/ellipsis when long bash command wraps?

Suppose I have this PS1 and PS2 prompts. PS1$> and PS2$> How can I display PS2 prompt when the command on PS1 wraps? like this: PS1$> this is the bash command and it will PS2$> wrap ...
1
vote
1answer
45 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
35 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
22 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 ...
3
votes
1answer
103 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
123 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 ...
0
votes
0answers
72 views

How to display bash prompt colors in tmux? [duplicate]

I'm using ubuntu 18.04 and tmux 2.6 echo $TERM in bash returns xterm-256color. In tmux it returns screen-256color On my terminal it looks like this: But when switching to tmux it looks like this ...
1
vote
2answers
104 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
225 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
36 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
131 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
38 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
25 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
23 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
73 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
116 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
33 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, ...
2
votes
1answer
97 views

Zsh Prompt Overwriting Itself

I am having a problem with zsh and zprezto where on error my cursor will shift to the left by two chars, overwriting part of the prompt. I have reverted my prompt file back to the original version, ...
2
votes
0answers
46 views

Bash search prompt overlapping value

Running a docker alpine container, my PS1 is: PS1="\u@\h:\w\$ " So when logging into the container, you get root@worker:/$ So if I type in something like root@worker:/$ cd /tmp/dir/path And then ...
1
vote
1answer
44 views

CentOS LiveCD Boot Prompt?

Booting CentOS LiveCD and received a prompt (see image). What is this for?
0
votes
1answer
46 views

How to add image to Linux prompt? [duplicate]

I was just watching a video and came across the below prompt Seems like lightening image is at the first and some big arrow like structure to display the directory path. Do you know how to do this in ...
0
votes
2answers
477 views

How to display directory in the prompt?

How can I display the directory before the $ in my prompt?
3
votes
1answer
123 views

When was the environment variable PS1 created?

I've always seen reference to pwd as being very essential 'back in the day'. These days we have customized command prompts like PS1 that display the current directory and pwd is pretty outmoded. But ...
1
vote
1answer
41 views

Set PS1 based on the number of jobs

From Bash's manual (Controlling the Prompt]1): \j the number of jobs currently managed by the shell. \$ If the effective uid is 0, #, otherwise $. What I'd like is to set PS1 to [some-string] $ ...
0
votes
1answer
52 views

Bash prompt changes for different users

With our latest hardware/OS refresh, we implemented FQDN throughout our domain. We are now having a problem getting the correct prompt in our terminal sessions when we ssh into a remote site. This ...
0
votes
1answer
105 views

How to get background and foreground color values from xrdb in shell script?

As in how can I get the *.foreground color value obtained with xrdb -query assigned to a variable in the script. I'm trying to get both background and foreground colors into two variables that will ...
3
votes
0answers
930 views

Why is initramfs dropping to a shell after installing Ubuntu next to a Windows 10 installation?

I have installed Ubuntu 18.04 LTS via Live USB on an ASUS Zenbook 13 UX331UN that is shipped with a preinstalled Windows 10. It is a UEFI system with secure boot enabled and fast boot disabled. I'm ...
2
votes
1answer
61 views

colorize hostname in command line prompt [duplicate]

I wish to set a custom color for the hostname portion of my command line prompt (in bash). In my .bashrc file, the default command line prompt is: PS1='[\u@\h \W]\$ ' To colorize the hostname only, ...
0
votes
0answers
22 views

Terminal / bash - $HOME is not displayed as ~ [duplicate]

When starting Terminal (bash), my prompt is: user@pc:/mnt/home/stud/user. Executing cd ~ it changes to user@pc:~ and pwd now is /home/stud/user as in getent passwd. I soft linked /home/stud to /mnt/...
0
votes
0answers
30 views

Time appearing after text in fish prompt

I'm on a mac and I'm using iTerm2, although this still happens in Apple's terminal. This doesn't happen in bash or any other prompt. Changing my fish_prompt doesn't affect this. I have no idea what's ...
0
votes
1answer
43 views

Terminal prompts have a mysterious [I] in it

I have been using fish shell for a while, but only recently got into playing around with the oh-my-fish framework and theming the prompt. I cannot figure out what this [I] character means! In most ...
0
votes
2answers
85 views

Strange behavior of PS3 and PS4 prompt variables

I know that it's possible to customize the prompt (as detailed in the 6.9 Controlling the Prompt section from Bash manual) and I have done it for a while, but I recently noticed some strange behavior. ...
1
vote
1answer
112 views

Command substitution not occurring for PS1 variable in zsh

I'm having the hardest time trying to get dynamically evaluated command output in my PS1 prompt with zsh on Ubuntu 17.10. Here are a few attempts I've made (I begin in directory /abc, and the prompt ...
-1
votes
1answer
41 views

Powerline and gdb

GDB in TUI-Mode shows strange behaviour. I'm using powerline and it seems that the font is the wrong one. Exist there a solution to have a pretty command line? How can I invoke a program not using ...
0
votes
1answer
94 views

Make a bash PS1 that counts streak of 'correct' commands

My goal is to have a bash prompt that displays a shortened username, a shortened path in blue, and a counter variable that gets reset every time I mistype a command (which I will check with $?, though ...
2
votes
1answer
227 views

How to reset the bash command number \#

The command number in bash specifies the number of commands typed since logging in as that user to whatever terminal you have open. It can be seen in your PS1 with \#, such as in export PS1="\! \# \\$...
1
vote
0answers
66 views

bash prompt has a unknown prefix

console show strange prompt prefix like this: ;user@centos:~[user@centos ~]$ echo $PS1 [\u@\h \W]\$ ;user@centos:~[user@centos ~]$ this problem just appear in console, ssh remote login no this ...
2
votes
1answer
320 views

ssh shows no prompt and authentication fails

I have a VPS running Debian 7 which I use to access through ssh for as long as 4 years. Now, suddenly, when I try to connect to it, no prompt for password is shown, although the connection to remote ...
0
votes
0answers
14 views

Commands are overwriting prompt after certain length [duplicate]

After I made some changes, on Debian 9, to my prompt, it start behave.. strange. Like you see bellow, it start wrapping after command overflow certain length. I wanna keep it simple, so only thing I ...
3
votes
0answers
387 views

Display git branch in terminal

I am using fedora OS and I want to display git branch or tag in terminal when I go into the git folder project. I follow this tutorial. After I ran: source /usr/share/git-core/contrib/completion/git-...