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
1answer
13 views

Cat activates mystery prompt

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
23 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
41 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
0answers
54 views

tty would not let me type password

When i press Ctrl + Alt + 1 I am able to open the tty successfully. It prompts me for username. But as soon as the password prompt appears, the keyboard cursor quickly moves to the next line! - like ...
0
votes
0answers
39 views

How do I move the zsh to the left side of the screen? [closed]

I don't know what I did to make this happen, but my zsh shell is offset to the right a bit. How do I get it to be flush with the left side of the screen? I have attached an image to show the issue. It'...
-1
votes
1answer
30 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
58 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
53 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
47 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
33 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
25 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
38 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
162 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
77 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
62 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
178 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
67 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
29 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
62 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
28 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
49 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
48 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
88 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
34 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
31 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
81 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
52 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
44 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
24 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
239 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
243 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
226 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
391 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
37 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
302 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
50 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
31 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
110 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
174 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
43 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
140 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
48 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
53 views

CentOS LiveCD Boot Prompt?

Booting CentOS LiveCD and received a prompt (see image). What is this for?
0
votes
1answer
52 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 ...
1
vote
2answers
1k views

How to display directory in the prompt?

How can I display the directory before the $ in my prompt?
3
votes
1answer
171 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
66 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
56 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 ...