Questions tagged [prompt]

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

Filter by
Sorted by
Tagged with
3
votes
0answers
40 views

Where is the @ sign in front of my raspbian-bash-prompt coming from? [duplicate]

There is @-sign in front of my raspbian-bash-prompt (headless) which I can't determine where it is coming from. $ ssh pi@raspberrypi Linux raspberrypi 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 ...
4
votes
1answer
103 views

How to set shell to wrap words for long commands?

I connect to a Slackware server. When a command is longer than the size of the putty window, the line continues in the same line, and the start of the command disappears as I continue adding to the ...
2
votes
2answers
70 views

SSH - print an input prompt to terminal overriding redirection

I have two scripts: test_input.sh is a script which is executed through SSH. In this script I ask the user for something in input. test_ssh_connection.sh is a script which connects to localhost and ...
5
votes
0answers
43 views

cat in process substitution hangs: what is it waiting for? [duplicate]

I have this piece of code using Process Substitution. When I run it, it works fine, but it does not exit - just hangs there waiting for input. Why and how to overcome? prepro() { in=$(<...
2
votes
2answers
46 views

How to tune this `scratch` alias for Bash by using the `PS2` variable?

Very often, I need to quickly type some lines of characters (for instance for simplifying a mathematical expression) and then discard the whole stuff. Of course, I generally have several running ...
0
votes
1answer
36 views

How to get a prompt after each while loop iteration?

I want a prompt after each loop iteration. FOR EXAMPLE : When one iteration is performed, I need Press Enter to continue and then again after second iteration, again after third and so on. I am ...
1
vote
2answers
54 views

Choose an option from select in bash

I am trying to run gem uninstall bundler through a bash script. The issue occurs when I have multiple bundler versions installed. It prompts the number of versions, and last option is to uninstall all ...
0
votes
1answer
78 views

How to customize .cshrc to configure command prompt?

Background Inspired by this question, I wanted to try to change my command prompt in this manner Enter this line into ~/.cshrc a. setenv PS1 "\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[...
4
votes
1answer
447 views

Bash prompt takes only the first word of a hostname before the dot

I configured my machine as the following hostname ( in reshat 7.2 ) digi.master01.usa.com but my prompt is like this [root@digi ]# while we want [root@digi.master01 ]# any idea how to change ...
0
votes
1answer
59 views

Bash prompt special character not expanded in PS1

I'm trying to set my PS1 environment variable based on runtime condition, so I use the PROMPT_COMMAND to do so. Suppose I want to change my bash prompt based on $? value, my .bashrc would look like ...
1
vote
1answer
38 views

Implications of using a plain string command instead of a function in .bashrc (particularly for PROMPT_COMMAND and PS1)

I have trouble understanding: How is .bashrc parsed How are bash functions constructed I try to customize my terminal prompt. My .bashrc make use of PROMPT_COMMAND like this (it's actually much more ...
1
vote
0answers
40 views

Why does xterm's command line behave like this after changing the prompt?

In my .cshrc file I have the following line: set prompt="%B%n@%m [%d %T] (%h) %c3%#" When I open an xterm, I see user@host [Fri 13:37] (2) ~>0;238;0c Why is 0;238;0c there? I can't spot the ...
2
votes
1answer
27 views

What does the leading part of Bash's default PS1 in Ubuntu mean?

This is the $PS1 of my Bash shell on a freshly installed Ubuntu 18.04: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \$ I can ...
7
votes
2answers
961 views

How to produce a PS1 prompt in bash or ksh93 similar to tcsh

In tcsh, I have the default: prompt [%m:%c3] %n%# which gives prompts like: [woehler:hacking/c/hello] ajcarr% and [woehler:~] ajcarr% In other words, the current directory and up to the next ...
1
vote
2answers
51 views

How do you make a custom prompt? [closed]

I would love help on making a prompt, I know how to make commands, but I want to make something like: V-PROMPT:> I know I could just do read -p 'V-PROMPT:>' but I want to be able to put ...
1
vote
1answer
46 views

Conditional powerlevel9k prompt

I want to de-activate my right prompt when the tmux terminal pane gets small. Is there an easy way to conditionally render the RPROMPT variable based on screen width?
0
votes
2answers
84 views

How to retrieve prompt format string in csh / tcsh

My current prompt format string is generated by an outside script that is provided by the organization. I want to manipulate it a bit (add time to the string) for that I need my current format string. ...
0
votes
0answers
53 views

Line wrap broken after using PS1

The line wrap is working weirdly when I use the following PS1: export PS1="\[\033[00;32m\][\d \T] \[\033[0;31m\]\u@\H:\[\033[0;37m\]\w\[$(tput sgr0)\] \n\[\033[0m\]$ " It is line wrapping onto the ...
3
votes
1answer
143 views

Where is the PS1 prompt variable set in ash shell?

I have a NAS drive from Western Digital. I can ssh into it, and when I log in, the first line that appears is: BusyBox v1.20.2 (2014-10-30 15:28:59 CST) built-in shell (ash) I don't like the default ...
6
votes
2answers
101 views

Emit zero-width bash prompt sequence from external binary

In bash, how do I encode zero-width sequences into PS1, when those sequences are coming from stdout of an external process or function? How do I implement writes-prompt-sequences-to-stdout so that it ...
0
votes
1answer
29 views

How to prompt data on piped commands [duplicate]

I'm trying to use this command: mysqldump --opt --hex-blob \ -h source -p xxxx -u user1 \ source_db | \ mysql \ -h target -p yyyy -u user2 \ target_db So, how can I rewrite it to ...
2
votes
2answers
120 views

Prompt to reflect sshfs mountpoint?

I use sshfs to remotely mount a remote folder to my local machine, the problem is that I need a way to know that I'm working under remote folder on local machine OR local folder to avoid accidentally ...
-2
votes
1answer
46 views

Cat activates mystery prompt [duplicate]

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
33 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
210 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
1answer
38 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
111 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
349 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
66 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
180 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
32 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
52 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
273 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
90 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
147 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
614 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
79 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
30 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
227 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
164 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
83 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
58 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
152 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
43 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
35 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
192 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
78 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
132 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
45 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 ...