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
184 views

Meaning of \ before environment variable

In ksh on an old Solaris box I used: export PS1="$PWD $" to set the prompt to the current directory. It works great until you cd elsewhere, then you see that it's not evaluating PWD each time. I ...
-1
votes
0answers
74 views

Why does hash “#” represent root in a prompt?

From here, I am able to understand the reason for using the $ sign for a single user prompt. However, I can't find anything related to the hash # symbol being used for the root prompt.
1
vote
1answer
18 views

Partially duplicated history when setting PS1 in .bash_profile [duplicate]

When I set PS1 variable in ~/.bash_profile, it worked as configured. However, the history is somehow messed up. When I press Arrow Up or Ctrl+P to view commands I typed, it starts to duplicate ...
16
votes
5answers
2k views

Why do I sometimes get repeatedly prompted with “>” in the terminal?

Alright, when I run certain commands the wrong way, (misspelled, etc.) The terminal outputs this: > instead of computername:workingfolder username$, and when I type enter it goes like this: > ...
0
votes
1answer
41 views

ANSI escapes in Pash prompt are displayed as garbage in Gnome terminal

I would like to use Pash, a PowerShell implementation for mono on my CentOS box. After compilation I started it and got $ mono Source/PashConsole/bin/Debug/Pash.exe ...
2
votes
1answer
36 views

w command for the other network hosts

While the who command refers to the local machine, rwho shows the same informations about all the known hosts of the local network. Similarly, w shows informations about the users on the local ...
6
votes
5answers
2k views

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

Changing title without changing prompt on Cygwin

I have the following shell script function from this site that allows me to change the title in both Putty and Cygwin. In Putty connected to a Linux host it changes the title and leaves the prompt as ...
2
votes
1answer
38 views

create a dash prompt

When I log in to my server which has dash as default shell, I get a prompt that looks like this: \[\033[1;31m\]\u\[\033[0m\]@:\w # How can I configure the server that it shows something like this? ...
1
vote
1answer
93 views

How does Git change the shell prompt in Aptana Studio's Cygwin Terminal?

I'm running Aptana studio 3.3.2. The command echo $SHELL outputs /bin/sh. However there is no value for the PS1 environment variable which I would like to inspect. I cannot there is no .bash_profile ...
1
vote
2answers
40 views

Howto include output of a script into the zsh prompt

I would like to add the output of a Python script into my zsh prompt but I am not sure how to do it? Is this done by what is called "PROMPT EXPANSION" in the man pages? Please someone set me on the ...
0
votes
1answer
42 views

Changing my default directory in passwd changes my prompt

I don't understand what's happening in this scenario. I changed the home directory of a user by editing the /etc/passwd file instead of using usermod -d. It worked: the default directory wasn't ...
1
vote
2answers
54 views

Which part of this bash PS1 config determine the color?

I got my git branch color set by this tutorial:http://www.bramschoenmakers.nl/en/node/624 But recenlty I've reverted my terminal background color, and the yellow branch name is nearly invisible under ...
4
votes
1answer
106 views

How do I stop a bash shell PS1 color to stop at the end of the command?

So simple question really, I have a custom PS1 colour where I have the actual shell commands in a distinct colour, just so I can quickly see what commands I typed and separate it from the command ...
1
vote
1answer
1k views

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?
3
votes
2answers
95 views

bash - complex prompt

I want to have really complex prompt. It should contains login, computer name, date, time, working directory, result of last command and new line symbol. I want to color each item as well. So I ...
4
votes
1answer
141 views

Backspace deletes Bash prompt

I recently modified my Bash prompt via the $PS1 variable so that I could have color. It is in my .bashrc file: PS1="\\[\e[0;32m[\h::\W] >>\e[m " Now if I type something and then have to ...
1
vote
3answers
587 views

How to set the command(s) that get run before every single prompt?

I used to know this but I forgot: I want to execute a command or a couple of commands before every single prompt. When I am in our PROD box, I want a big fat reminder above every prompt that says * ...
-2
votes
2answers
66 views

Getting a propmt when deleteing a non-directory

I want to get a prompt when attempting to delete a non-empty directory with rmdir. Is this possible?
1
vote
1answer
41 views

why is EXPORT PS1 in my .profile getting clobbered?

In this question How can I get KornShell to display the date and time in the prompt? all the variables are visible in ksh except PS1 which appears to be getting replaced somehow. How can I determine ...
2
votes
1answer
70 views

How can I get KornShell to display the date and time in the prompt?

On my AIX box, which is using ksh as the default shell, I'd like the prompt to show both the date and time followed by a newline \n, along with the name of the machine, and the working directory. ...
13
votes
5answers
528 views

Stateful bash function

I’d like to implement a function in Bash which increases (and returns) a count with every call. Unfortunately this seems non-trivial since I’m invoking the function inside a subshell and it ...
1
vote
3answers
198 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 ...
1
vote
3answers
107 views

Problem when splitting command with backslash in unix prompt

I often use the space-backslash combination ( ) to split a command and its parameters into various lines and make it more readable: /home/user> ls -ltra \ > file1.txt \ > file2.txt ...
1
vote
1answer
1k views

busybox ash PS1 not expanding

I am trying to setup busybox's ash on an embedded system to support expanding the PS1 prompt statement. I have it currently set as PS1='\u@\h:\w\$ ' However, all that is displayed is literally ...
14
votes
3answers
658 views

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

zsh/Prezto: difficulties with right prompt alignment

This may be stupidly simple, but... I am trying to make my own prompt for Prezto. I have been using numerous prompts for reference (I can post a list if necessary). My RPROMPT and cursor are refusing ...
1
vote
1answer
57 views

Identify python script is waiting for a manual input

I'm writing a shell script which executes a Python script. The Python script halts for a manual enter to be provided. However, I don't wan't to have to press enter each time to the script. Instead, I ...
7
votes
6answers
4k 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 } ...
1
vote
1answer
40 views

csh: Is there a prompt outside of $prompt?

Consider this c-shell grab: [<my-user>@<my-host> ~]>echo $SHELL /bin/csh \033]30;<my-host-name>\007\c [<my-user>@<my-host> ~]>set | grep prompt prompt [%n@%m ...
1
vote
1answer
30 views

Display Present working directory in Terminal

I am complete newbie to Mac/*nix. This is what I presently see in Mac Terminal as always EN-AAABBBB:~ username$ Probably, my understanding is EN-AAABBBB is my Mac name and followed by username. ...
1
vote
2answers
79 views

Temporarily freeze a process upon shell interaction

Let's say on a single console I have tail -F running, showing the output of many log files in realtime. Sometimes I need to run commands there too, however, and examine their output briefly, without ...
2
votes
2answers
353 views

How can avoid these spurious characters in my bash prompt?

I have Fedora 20, and I would like to adapt the bash prompt to make it even more useful to me. At present my PS1 prompt is set by these lines in my ~/.bash_profile file: LP=" Last prompt at: " ...
76
votes
8answers
82k views

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-lin, because color makes the output more useful and intuitive. What are some good ...
0
votes
1answer
26 views

Is it possible to save in a log everything the system outputs when I turn it on?

I am using a BeagleBone Black without any screen. It works fine, but sometimes when I turn it on it hangs and have to reset. I do not know why this is happening and since I cannot see whatever it is ...
5
votes
3answers
634 views

What are the color codes that I can use in my PS1 prompt?

I used several colors in my 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 ...
0
votes
2answers
141 views

How can I get my PS1 prompt to show time, user, host, directories and git branch

I've seen others add all this information to their PS1 prompt. I like the approaches that colorize the elements and also do a carriage return at the end
3
votes
1answer
131 views

Screwed up my bash prompt, what happened?

I just thought I might get version information about the current bash by entering bash -v That brought many lines of code to stdout and left me with a line that appears right above my usual promt ...
-1
votes
2answers
118 views

Update .profile in /etc in UNIX

How can i append the following text in .profile in folder /etc/security of UNIX OS? PS1='hostname -s':$LOGNAME'[$PWD]' i tried: print 'export PS1='hostname -s':$LOGNAME'[$PWD]' ' >> profile ...
2
votes
1answer
96 views

Get bash DEBUG trap to execute only once for and/or lists?

Suppose I set a trap on DEBUG like so: unset PROMPT_COMMAND # don't want $PROMPT_COMMAND triggering DEBUG trap trap 'printf %s\\n "most recent history line: $(history 1)" >&2' DEBUG If I do ...
16
votes
3answers
5k views

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

How can I select a beginning…ending portion of a '/' delimited string (PS1 prompt in my case)

I am customizing my PS1 prompt, specifically the $PWD part which is delimited by /'s among several things I like having the current directory. However if the directory is too long I'd like to have ...
1
vote
2answers
498 views

Adding to PS1 in bash_profile

In my .bash_profile currently, I have PS1='\[\e[1;91m\][\u@\h \w]\$\[\e[0m\] '. I am trying to follow these commands to show branch name on iTerm terminal. I changed my PS1='\[\e[1;91m\][\u@\h ...
0
votes
3answers
602 views

Proper place to put shell prompt(PS1) when use sh/bash/zsh together

I'm using dash(sh) or bash or zsh. If possible, I would prefer to put in common place. I want to put proper PS1 settings when I interactive with shell, so these situation should be considered login ...
1
vote
1answer
171 views

Show path from project root in ZSH Prompt

If my pwd is ~/repos/blog/app/views/, I'd like to show only blog/app/views in the prompt i.e. I want to show only the project root. Project root is the parent directory of .git directory. Is there a ...
1
vote
1answer
43 views

Expansion in zsh prompt

I'm struggling with zsh prompt, trying to convert my bash prompt to zsh hooks. This code should display the current kerberos ticket and update accordingly, but colors don't work, neither does the ...
5
votes
2answers
5k views

Colored Prompt in KornShell

According to this StackOverflow post, it is possible have a colored prompt in KornShell. I have not been able to figure out how to do this. I am able to use color: echo -e "\033[34mLinux\033[00m" ...
3
votes
4answers
201 views

How do I output a suggestion for a user to accept and use as input?

What can I do to leave the cursor on the same line of the suggestion in a Bash script? Bash version = 3.2.51 It's purpose is to suggest a string so that the user should only press Enter. #!/bin/sh ...
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 ...
5
votes
3answers
315 views

change prompt formatting based on cwd

I use tcsh. I'd like to have my prompt formatting (coloring/highlighting) change based on the directory I'm in, or other critical aspects of my environment. I'm not enough of a shell hacker to know ...