A string of characters displayed by interactive shells to signal the shell is waiting a user input. The prompt can be used to display variables and data about the enviornment.

learn more… | top users | synonyms

2
votes
2answers
688 views

Bash prompt when my home directory is a symbolic link

I symlinked my /host/Users/Kevin folder to /home/Kevin. I also edit the /etc/passwd file to /home/Kevin. I logged out and logged back in, however when I open up a terminal it's a bash prompt like so: ...
2
votes
2answers
1k views

How to change the prompt in Linux?

The default prompt will be root@monu dev]# Can we change the "root@monu" part and give it a desired name?
2
votes
1answer
388 views

Is it possible to customise the prompt to show the if there are any background jobs?

Is it possible to customise the bash prompt to show the if there are any background jobs? I find it easy to forget that there are background jobs. Say if the prompt was... $ Is there a way to ...
2
votes
1answer
226 views

ZSH %m prompt escape not working as documented under Debian Linux

The zshmisc man page on my new Debian Squeeze install states, under SIMPLE PROMPT ESCAPES: %m The hostname up to the first `.'. An integer may follow the '%' to specify how many components of the ...
2
votes
2answers
279 views

Shell Prompt Customization? [closed]

I have used oh_my_zsh (and tinkered with bash_it) on multiple systems and have generally been happy with it, though I hate it's auto-correction feature and generally turn it off. My usual shell is ...
5
votes
1answer
363 views

history list in bash always truncated to 5000 lines at new login

Similar to the 5000 line limitation problem when first thing in .bashrc I have export HISTSIZE=10001 and export HISTFILESIZE=$HISTSIZE My users do not have ~/.inputrc files and the system-wide ...
4
votes
2answers
830 views

Admin user not showing directory path in console prompt, only $

I have an Ubuntu server that I administer through ssh. When I login as root I get a full path in the prompt, like /var/www. I created a user with sudo privileges for the purpose of administration. ...
0
votes
2answers
247 views

pwd not being set correctly in zsh prompt

If I type this in my PROMPT in my .zshrc file: PROMPT="`pwd` >" I expect that it will print the current working directory. However, pwd always prints /Users/kevin. Why doesn't it show my current ...
3
votes
1answer
1k views

Set variables in ZSH precmd and reference them in the prompt

Is there a way to set variables in the precmd function of zsh and then echo them in the prompt? Something like function precmd { GREETING='Hi Kevin!'; } PROMPT="$GREETING";
1
vote
0answers
112 views

Doubt on the value of PS1 environment variable [duplicate]

Possible Duplicate: What is $debian_chroot in .bashrc? In Bash, why is PROMPT_COMMAND set to something invisible? I logged into my computer from a normal user and executed the following ...
8
votes
4answers
6k views

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 ...
6
votes
2answers
1k views

Bash $PROMPT_COMMAND messing up scroll history display

I set up a PROMPT_COMMAND to display the current branch while I'm in a git repo. The relevant part of my .bashrc is: export PS1=" \[\033[34m\]\$\[\033[0m\] " export ...
7
votes
1answer
726 views

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 ...
5
votes
1answer
1k views

In Bash, why is PROMPT_COMMAND set to something invisible?

On RHEL6 and CentOS 6, /etc/bashrc sets PROMPT_COMMAND here: case $TERM in xterm*) if [ -e /etc/sysconfig/bash-prompt-xterm ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm ...
8
votes
4answers
1k views

Abbreviated current directory in shell prompt?

vim has a really nice feature which it utilizes in its paths when they're a bit long: It abbreviates the path to the document in the tab at the top. Is there a way to do something similar to this ...
33
votes
2answers
12k views

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

Populate PS1 asynchronously

I have a few git svn related functions that see if I have to pull/push from/to the repository. My problem is that the functions I've wrote to gather these informations are too slow, I'd like to make ...
2
votes
1answer
1k views

Multiline PS1 prompt

Is the a way to specify a multi line prompt in Korn shell? I am planning to swhitch from bash to ksh. In bash I have a very simplistic prompt, but it is 2 line prompt. I hate when input position ...
5
votes
2answers
268 views

Display Non-Zero Return Status in PS1

I want to include the return status in my prompt. (Easy add '$? ', right?) However, I only want the status returned (and trailing space) if non-zero. Example: sd ~ $ false 1 sd ~ $ true sd ~ $
2
votes
1answer
388 views

There is no bash indicator prompt after a forked process terminates

I am reading the book Advanced Programming in the Unix Environment. There is a test program to test the fork function. It works well in my Ubuntu. But what I confused is that why there is no command ...
3
votes
2answers
970 views

Bash prompt keeps disappearing

I have a weird issue where my Bash prompt often completely disappears on a backspace. Doesn't make any sense to me, but it happens often: I can't really think of why this is happening. Am I ...
5
votes
5answers
325 views

Conflict between my prompt definition and cat in zsh

I have a file on a remote filesystem that I know has a short text string in it (a sequence of numbers in a single line). If I open the file on a text editor like nano or Emacs I can see the string. ...
3
votes
1answer
2k views

Showing GNU screen session name and window title in shell prompt

Is there a way to present the GNU Screen session name and window title in the prompt of the shell (let us say, the Bash prompt defined by PS1)?
4
votes
4answers
920 views

Which stream does Bash write its prompt to?

I am trying to redirect all output from bash (prompt, user input, results) to a file Example: /bin/bash > file.txt 2>&1 I thought that would work, but I'm not getting the prompt. Can ...
1
vote
2answers
542 views

Unix read -p command causes bash error, how do I fix it?

I'm trying to prompt the user for a comment function comment { if [ ! $1 ] then read -p "enter checkin comment < " COMMENT; else export COMMENT="$1" fi if [ ! $COMMENT ] ...
6
votes
1answer
187 views

How can I output “temporarily” to the shell, like zsh tab completion does?

In zsh shell, when you hit Tab twice to get tab completion, your options are displayed below your prompt. But when you make a selection, the options disappear. I have a little script that outputs ...
6
votes
3answers
552 views

Bash history number not starting at 1?

I was customizing my bash prompt (I'm on OS X 10.7) when I came across something strange. Within my prompt I included !, which should give me the history number. However the history number always ...
1
vote
1answer
128 views

Printing evaluated prompt placeholders to screen

Is there a way to print interpreted PS1 variable placeholders to console? Something like $ echo `%u` for printing a username or $ echo `%h` for printing a host. I do know about environment ...
3
votes
2answers
968 views

How to script /etc/issue?

I would like to pipe my tty number through figlet (ASCII generator) for the /etc/issue (message shown before login). Obviously this means I can't just update it from /etc/rc.local. On my system ...
8
votes
1answer
4k views

How to change tty login prompt?

To be clear, I am not referring to /etc/issue (shown before the prompt) or /etc/motd (shown after login), but the prompt itself, which is currently hostname login: For good measure, I am running ...
2
votes
1answer
2k views

How do I customize the bash prompt on centos?

I've altered the /etc/bashrc file. I commented out the previous definition and inserted my own: PS1="--bash: (\u@\h:\w) $" This is not having any affect. When I make this change at the command ...
8
votes
2answers
3k views

How can I change what's displayed at a login shell?

I'm getting more familiar with tweaking the way things look in a shell via the prompt (.bashrc), but I'm now trying to change the initial stuff displayed when I first log in. On my EC2 instance, this ...
2
votes
5answers
5k views

In bash how can I change the color of my command prompt? [duplicate]

Possible Duplicate: How to customize .bashrc to configure command prompt? When I run a command, I often times have trouble finding the beginning of the command output. An easy fix to this ...
3
votes
2answers
2k views

Is there a way to push shell config information when SSHing to a host?

I know how to set the GNOME-terminals (or xterms!) prompt to green/red regarding the last exit code: vi .bashrc export PROMPT_COMMAND='PS1="` if [[ \$? = "0" ]]; then echo "\\[\\033[0;32m\\]"; else ...
3
votes
2answers
840 views

Strange Character in my Bash prompt?

I'm somewhat new to Bash prompts, but I was finally able to get things somewhat working. However, I have a strange character at the beginning of my prompt: Here's my actual PS1 prompt: ...
27
votes
5answers
2k views

Better way of accepting variations of ‘Yes’ from a shell prompt

Usability testing of a shell script I wrote found that people had different expectations on how to answer a question that expected ‘yes’ as the answer. See variations in the below code example. ...
3
votes
3answers
1k views

How to customize .bashrc to configure command prompt?

Is there an easy way to change my Bash prompt to modify the colors and what text is displayed? I've heard that this is done in .bashrc, but I haven't found any nice, easy ways of modifying it. How are ...
4
votes
1answer
544 views

Re-escape brackets in PS1

As others have pointed out, color codes in PS1 should be bracketed by \[ and \] to avoid them taking up horizontal space. I've added the necessary code to .bashrc: highlight() { if [ -x ...
3
votes
1answer
224 views

ssh behavior for root and non-root user

When I ssh as root to a remote machine, the command output looks like this: root@Machine:/current/path#: However, if it's a non-root user, all I see is: $ How can I get the same behavior as for ...
7
votes
3answers
564 views

Can I highlight the current prompt line in zsh?

Is it possible to highlight (set a background colour) for the whole line of the prompt in zsh? In my emacs config I have the line on which the cursor sits a slightly different colour to the window ...
18
votes
1answer
3k views

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 ...
13
votes
2answers
1k views

Display command in xterm titlebar

My Bash Prompt is currently setting the xterm titlebar using the following sequence: PS1='\033]0;\u@\h>\w\007' Is there an easy way to display the current command in the titlebar. For example, ...
6
votes
6answers
3k views

Bash: Display exit status in prompt:

GREEN="\e[1;32m" RED="\e[1;31m" NONE="\e[m" get_exit_status(){ es=$? if [ $es -eq 0 ] then echo -e "${GREEN}${es}${NONE}" else echo -e "${RED}${es}${NONE}" fi } ...
8
votes
2answers
1k views

How do you make RPROMPT in zsh update itself on every enter?

My RPROMPT is set to display svn info using vcs_info. It reads RPROMPT=${vcs_info_msg_0_}. vcs_info is called using precmd(). However, RPROMPT doesn't update when I change directories. It works only ...
4
votes
1answer
189 views

terminal - having “$” instead of MyComputer:~ me$

Right now in my MacOS X terminal I have MyComputer:~ me$ before all the commands. In some videos I saw they have just $ - that's much less clutter, how is it done?
3
votes
1answer
1k views

How to make my Linux tcsh prompt bold?

Greeting all, I am attempting to make my Linux tcsh prompt bold. However I'm failing miserably. I know about escape codes and I can successfully make echo'ed output bold, but I can't seem to do it ...
5
votes
5answers
488 views

Would it be possible to jump between prev/next command prompts?

I'm using zsh in OS X Terminal.app and for quite a while, I've been longing for a way to jump back and forth between prev/next prompts in the terminal's output. One convenience with this would be to ...
3
votes
2answers
157 views

How can I display the time when a command was executed in my bash prompt?

Currently my bash prompt looks like this $ echo $PS1 # \[\e[34m\][\t]\[\e[0m\] \[\e]0;\w\a\]\[\e[34m\]\u@\h: \[\e[34m\]\w\[\e[0m\]\n$ $ The problem is that \t will only display the time when the ...
1
vote
3answers
186 views

Is it possible to know when you're at the first bash prompt of a terminal?

This is sort of a contiunation of my last question: printing saving the last bash input command Now I want to know if it's possible to know when you're at the first bash prompt of a terminal. So I'm ...
4
votes
1answer
2k views

Printing (saving) the last bash input command

How can I get the last executed command from bash? I know that !!:p prints the last command, but it seems I can't use that anywhere except the bash prompt. I tried echo !!:p but it prints ...