Questions tagged [prompt]

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

A prompt is a string of characters displayed by a shell or other command line program to indicate that it is waiting for user input.

Further reading

645 questions
311
votes
25 answers

Colorizing your terminal and shell environment?

I spend most of my time working in Unix environments and using terminal emulators. I try to use color on the command line, because color makes the output more useful and intuitive. What options exist to add color to my terminal environment? What…
Stefan Lasiewski
  • 19,264
  • 24
  • 70
  • 85
243
votes
10 answers

Terminal prompt not wrapping correctly

I have an issue where if I type in very long commands in bash the terminal will not render what I'm typing correctly. I'd expect that if I had a command like the following: username@someserver ~/somepath $ ssh -i…
Muricula
  • 2,540
  • 2
  • 12
  • 6
202
votes
8 answers

What color codes can I use in my Bash PS1 prompt?

I used several colors in my bash PS1 prompt such as: \033]01;31\] # pink \033]00m\] # white \033]01;36\] # bold green \033]02;36\] # green \033]01;34\] # blue \033]01;33\] # bold yellow Where can I find a list of the color codes I can use? I…
Michael Durrant
  • 41,213
  • 69
  • 165
  • 232
176
votes
3 answers

Why ZSH ends a line with a highlighted percent symbol?

I've noticed this on occasion with a variety of applications. I've often thought it was because the output was cancelled early (ctrl+c, for example) or something similar, and zsh is filling in a new line character. But now curiosity has gotten the…
jktravis
  • 2,156
  • 2
  • 13
  • 15
97
votes
2 answers

Why is my bash prompt getting bugged when I browse the history?

Often when I start looking at history of commands some of the characters from a command displayed aren't erased, for example: What's happening: prompt$ some_command prompt$ some_commanother_command What should have happened: prompt$…
korda
  • 1,561
  • 1
  • 12
  • 14
94
votes
3 answers

Awesome symbols and characters in a bash prompt

I just ran across a screenshot of someone's terminal: Is there a list of all of the characters which can be used in a Bash prompt, or can someone get me the character for the star and the right arrow?
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
73
votes
5 answers

How can I tell if I'm in a tmux session from a bash script?

I like to keep my bash_profile in a git repository and clone it to whatever machines I have shell access to. Since I'm in tmux most of the time I have a user@host string in the status line, rather than its traditional spot in the shell prompt. Not…
Brant
  • 835
  • 1
  • 7
  • 9
66
votes
7 answers

How can I change my bash prompt to show my working directory?

I can print my current working dir like this myPrompt$ pwd /Users/me/myDir I want my shell to look like this /Users/me/myDir$ pwd /Users/me/myDir Is that possible? How can I do it?
bernie2436
  • 6,505
  • 22
  • 58
  • 69
57
votes
12 answers

make my zsh prompt show mode in vi mode

I use bindkey -v (for bash-ers set -o vi I think that works in zsh too) or vi(m) mode. but it bugs me that I don't have any visual cue to tell me whether I'm in insert mode or command mode. Does anyone know how I can make my prompt display the mode?
xenoterracide
  • 57,918
  • 74
  • 184
  • 250
53
votes
1 answer

In which situations are PS2, PS3, PS4 used as the prompt?

When I log on into the shell I see the prompt whose value is stored in PS1. I also encountered another prompt (but do not know which one) when I used the here-document syntax: bc << HERE > But that is all the types of prompts. I have encountered so…
Abdul Al Hazred
  • 25,760
  • 23
  • 64
  • 88
36
votes
5 answers

tmux not colorizing PS1 prompt

I recently decided to change my PS1 variable to accommodate some pretty Solarized colors for my terminal viewing pleasure. When not in a tmux session, everything is great! Rainbows, ponies, unicorns and a distinguishable prompt! Cool! The problem is…
J. Sagurton
  • 471
  • 1
  • 4
  • 7
35
votes
5 answers

How to make the terminal display user@machine in bold letters?

I have seen in some screen-shots (can't remember where on the web) that the terminal can display the [username@machine /]$ in bold letters. I'm looking forward to getting this too because I always find myself scrolling through long outputs to find…
neydroydrec
  • 3,777
  • 8
  • 32
  • 42
35
votes
3 answers

Using variables to store terminal color codes for PS1?

In my .bashrc, I use ANSI terminal color codes to colorize various bits. It looks like this: PS1='\u@\h:\w\[\033[33m\]$(virtual_env)\[\033[32m\]$(git_branch)\[\033[0m\]$ ' where virtual_env and git_branch are bash functions that output stuff on…
Ismail Badawi
  • 535
  • 2
  • 5
  • 8
34
votes
4 answers

Shorten path in zsh prompt

Bash has the PROMPT_DIRTRIM option, e.g. when I set PROMPT_DIRTRIM=3, then a long path like: user@computer: /this/is/some/silly/path would show instead as: user@computer: .../some/silly/path Does a similar option exist for zsh?
pfnuesel
  • 5,702
  • 8
  • 35
  • 60
33
votes
7 answers

How to make bash put prompt on a new line after cat command?

What I get: host:~ user$ cat example.txt some texthost:~ stas$ What I want to get: host:~ user$ cat example.txt some text host:~ stas$ Is there a way I can make cat behave like this? I'm using bash on Mac OS X.
Stanislav Shabalin
  • 433
  • 1
  • 4
  • 5
1
2 3
42 43