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

Configure zsh prompt to show only first 2 letters of current directory

I would like to display only the first two letters of the current directory. I tried PROMPT="%1d %# " which displays the current directory as directory1. But taking a subset of the ...
First Name's user avatar
0 votes
1 answer
66 views

Creating a custom tilde-like directory?

A bit of backstory: For a while now i've just been putting my personal files & directories in the user home directory. However something that has always annoyed be about this is that they get ...
p0sa's user avatar
  • 11
0 votes
0 answers
48 views

(In starship) How do I hide the right prompt if the shell is small?

I have 3 monitors, but one is tiny. My terminal is on the tiny monitor, and starship is configured for a massive right prompt. Can I hide this based on terminal size? I'm aware that the right prompt ...
Perodactyl's user avatar
0 votes
1 answer
24 views

prompt in git hook?

I'm trying to implement an option to skip a pre-commit hook (which will be considered pass and perform the commit) in a pre-commit hook. Everything is running fine except the prompt which reads an ...
Tomáš Pilný's user avatar
0 votes
0 answers
18 views

Kitty shortcut to escape prompt

Inspired by this answer I have the following mapping in my kitty.conf to escape a stuck command quickly: map ctrl+shift+z send_text normal \x1akill -9 %%\r But for commands which prompt the user such ...
xeruf's user avatar
  • 501
0 votes
1 answer
181 views

zsh PROMPT coloring doesn't work inside of tmux

I have the following line in my .zshrc: export PROMPT="%n@%K{9}%m%k:%~# " It works if I connect directly But doesn't work inside tmux How to fix?
Dims's user avatar
  • 3,195
-1 votes
3 answers
512 views

Understand PS1 environment variable

On Stackoverflow, I just saw a question concerning the PS1 environment variable, which is responsible for the Linux terminal prompt. My prompt looks as follows: username@PORT-usr:/dir username is the ...
Dominique's user avatar
  • 141
0 votes
0 answers
83 views

How do I fix "\!" output ("-bash: !: command not found" error) from __git_ps1 in prompt?

I've noticed that I sometimes get spurious \! output in my bash prompt. (In iTerm on macOS Ventura. I can also reproduce in Terminal.app.) I can reproduce it by holding down or repeatedly pressing the ...
Henrik N's user avatar
  • 401
0 votes
0 answers
15 views

sudo: timed out reading password [duplicate]

Today I've run into a strange monologue of sudo: [sudo] password for me: sudo: timed out reading password sudo: a password is required [sudo] password for me: sudo: timed out reading password sudo: ...
user619271's user avatar
0 votes
1 answer
101 views

ANSI escape sequences in PS1 cause incorrect length calculation [duplicate]

I have a PS1 set up in my .zshrc which includes multiple ANSI escape sequences. An equivalent definition works nicely in Bash, but in Zsh (v5.8.1) it seemingly causes the shell to calculate the width ...
Konrad Rudolph's user avatar
0 votes
2 answers
478 views

Is it possible to make bash stop blinking text?

I've been playing around with bash a bit and was wondering if it is possible to make blinking text stop if I execute another command. E.g. echo -e '\033[5mEXAMPLE\033[0m' will output a blinking ...
telometto's user avatar
  • 1,835
0 votes
1 answer
83 views

My fish prompt gets messed up when I add more set_color

I've been trying to make a custom fish prompt, but there's one problem that I can't seem to figure out how to fix. I got this to work, but it's not exactly what I want, as I want the ash@cat-box to be ...
Ash's user avatar
  • 1
0 votes
0 answers
60 views

Why does my bash script answer prompt without my asking?

I want to uninstall packages and reinstall them in user mode. I have a manually edited list made with flatpak list, where the first word of the line is the complete name of the package. I can make a ...
Cormor's user avatar
  • 1
1 vote
1 answer
300 views

oh-my-zsh prompt substitution

I'm modifying the intika2 theme in oh-my-zsh to add the current pyenv setting to my prompt. OMZ includes a pyenv_prompt_info command & I added it to the LEFTINFOS variable in the intika2 theme to ...
Todd Vanyo's user avatar
-2 votes
1 answer
597 views

$PS1 vs $PROMPT_COMMAND in bash?

I'd like to customize my shell's prompt. What are the differences between $PS1 and $PROMPT_COMMAND, and what variable should I use? Some historic conventions (of past shells/posix) to find out what is ...
Junaga's user avatar
  • 341
-4 votes
2 answers
757 views

How do I get a new command line to appear in terminal

What is the keyboard shortcut for getting another prompt ari@ari-virutal-machine: to appear:
user3316598's user avatar
0 votes
2 answers
300 views

Confused about bash prompt meaning

I found out that in bash, the $PS1 variable can be modified to change the prompt. The problem is that I'm having some trouble trying to understand the long string of codes that I was given. I did: ...
DepthsDoes's user avatar
0 votes
1 answer
218 views

[?2004l characters when login through ssh in debian

I have recently modified the $PS1 environment variable in /etc/bash.bashrc in Debian. To make those changes in my current session, I thought that I could restart bash.bashrc with: . /etc/bash.bashrc ...
user avatar
1 vote
1 answer
353 views

Custom Shell Prompt for Root per sudo/su user

Is it possible to have multiple users using a root shell but with different prompts on the BASH shell for each session/user? We have some training environments with our users using su/sudo to get to a ...
shocko's user avatar
  • 49
3 votes
3 answers
236 views

PROMPT_COMMAND output in shell script using piping LINUX

I want to make a shell script that shows the available data on my root directory and shows it continuously after each new command in the prompt by using PROMPT_COMMAND in the shell script. However, I ...
Baasman404's user avatar
1 vote
1 answer
194 views

Unable to get terminal prompt when executing script via ssh

I have the below script that works fine when run locally cat /tmp/input.sh echo -n ">> " read env exit; I get the command prompt when i ...
Ashar's user avatar
  • 459
0 votes
0 answers
18 views

Getting the prompt on Linux [duplicate]

Real noob question: Am trying to search for a file on Linux am using- systemctl to list all the files but after this list has finished displaying my prompt does not return, so am unable to search for ...
OB1's user avatar
  • 1
0 votes
0 answers
34 views

How do you get your prompt back after executing a command like systemctl on linux? [duplicate]

Real noob question: I was running a script on Linux- systemctl and I want to search for a specific file but before I can type in the new code | grep 'filenames I need to get the prompt back but am ...
OB1's user avatar
  • 1
0 votes
4 answers
207 views

Bash: interactively enter and save large html block into a variable from the terminal

This is simple #!/bin/bash echo "What is your name?" read name echo "Your name is: $name" But what if I don't want to treat a name but a large HTML code block with nested tags and ...
pastic's user avatar
  • 111
5 votes
2 answers
675 views

Get cursor location in tty without reading from stdin (need help with redirections)

I have written a fancy custom bash prompt, and it works really well; I just have an issue when trying to run multiple commands separated by newlines. (I apologise for the length, but I hope my issue ...
techhazard's user avatar
5 votes
1 answer
720 views

How to hide email from shell prompt with starship

Currently, my terminal looks like this: ~ on ☁️ [email protected] took 15s > I want to hide the email from the view such that the terminal view is just ~ took 15s > How do I go about doing ...
LoganN's user avatar
  • 111
2 votes
1 answer
295 views

Customize bash prompt without plugins

I am customizing my bash prompt in order to make it look a little bit fancier. Here is what I did (in the ~/.bashrc file, Ubuntu 20.04). # Customizing prompt t1_bg="\[$(tput setab 31)\]" ...
ado sar's user avatar
  • 133
0 votes
1 answer
371 views

How to convert this bash prompt to work in zsh terminal?

I am trying to get colored text in zsh, and I like the color options given in this bash command PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\]. ...
Krish's user avatar
  • 103
4 votes
2 answers
355 views

Setting up a name in the terminal Linux

My question is pretty silly, but could not find nothing on the internet that explained me how. The thing is that I want to have the name displayed in the terminal as: Server mpi@raspberry: ... $ but ...
Enzo Basile's user avatar
0 votes
0 answers
118 views

How to change Linux terminal prompt

I've been using Terminator as my terminal but after reconfiguring my display manager to 'Lightdm' after 'gdm3' crashed while installing updates, I messed something up, not with terminal, using the GUI ...
Georgey's user avatar
0 votes
3 answers
121 views

How to display a prompt and prevent execution against basic but dangerous commands like mv or rm

Objective Whenever I use mv (or commands of similar nature) I want my shell to prompt me something like "Hey, you used mv. Sorry but do it again using mv -i". I'd like to know the reasonable ...
dungarian's user avatar
  • 415
0 votes
1 answer
247 views

opening default path for root user

It may be trivial what I say, but I need to change the default opening path that OH My ZSH has. since no matter where I preposition myself in a file path (example: /home/username/Downloads/owt), when ...
RedBook's user avatar
3 votes
2 answers
599 views

String manipulation with backslash-escaped special character in bash prompting

I would like my bash prompt to show \etc\defaults using PS1 when I am in /etc/defaults. I have tried these two methods PS1="$(echo "\w" | sed 's/\//\\/g')" PS1="$(tmp="\w&...
Noob Life's user avatar
  • 151
-1 votes
2 answers
66 views

Is it possible to output LaTeX in a shell prompt?

There are several "lambda" prompts (i.e., shell prompts which use the $\lambda$ symbol). While these look nice in theory, many fonts do not use the lambda symbol that I like: $\lambdaup$. I'...
Joshua Crotts's user avatar
1 vote
1 answer
566 views

Ansible: How to verify ansible_become_user, and if missing prompt for user input (multiple hosts)

I use multiple hosts and I want to prompt user to provide sudo username and password if ansible_become_user and ansible_become_password is not set in the inventory or playbook I use following: ...
Rafal Niznik's user avatar
1 vote
4 answers
579 views

How to prevent child process to interfere with bash prompt?

The application in question is DaVinci Resolve. I start it from terminal. And when I close it, the message "Socket Disconnected" from the app is written to the terminal output. Then the bash ...
Ashark's user avatar
  • 769
1 vote
1 answer
799 views

Why is the prompt shown at the top of the terminal, rather than at the bottom?

Why am I asking this? As you can guess, it's mostly for curiosity. But why did the curiosity spring up in my mind? Well, there's been a moment when I noticed that I was not happy that after I'd run ...
Enlico's user avatar
  • 1,471
0 votes
1 answer
675 views

zsh: check whether I am currently inside my git repository (git check-ignore)

In my .zshrc, I am using following git command (from zsh prompt: check whether inside git repository and not being ignored by git) to check whether I am inside a git repository, so that I can change ...
Martin Vegter's user avatar
0 votes
1 answer
819 views

How do I include the current Anaconda env in my prompt?

I found this post that perfectly describes the problem I'm having. The only difference is that I'm using zsh. When I escape the '$' as @filbranden described, it just prints the $(basename $...
downtime's user avatar
0 votes
2 answers
785 views

Zsh tab completion moves command to the right by several spaces after modifying PROMPT in .zshrc

I recently wrote a function called zuperPrompt that prints out a nice looking prompt and I've set my PROMPT variable in my .zshrc to call that function like so: setopt PROMPT_SUBST PROMPT='$(...
Sam's user avatar
  • 11
1 vote
1 answer
307 views

Display branch name in $PS1 on ksh88

I want to display my current git branch in the prompt in ksh88. I'm working on a legacy project, when the backend run on IBM's AIX, with a mandatory ksh88 shell. I can switch to say, bash, for some ...
Rafiki's user avatar
  • 111
1 vote
1 answer
299 views

Zsh: how do I remove block prefixes when writing multi-line statements in interactive mode?

When I write multi-line statements in interactive mode in Zsh, it will prefix my statements with the block type I'm in like so: % for i in $(seq 3); do for> echo $i for> done 1 2 3 % function ...
mattmc3's user avatar
  • 342
1 vote
3 answers
837 views

Automatic SSH prompt input

I'm trying to copy a bunch of RSA keys to multiple servers for a specific user. Whenever I issue the ssh-copy-id command it asks me to confirm by typing "yes", then asks me for the password. ...
markfree's user avatar
  • 185
6 votes
0 answers
1k views

Equivalent of PSReadLine for bash

For my Windows Terminal using Powershell I have the plugin PSReadline which gives me some pretty handy features. For instance a navigatable list view of my history when I start typing. So if I type cd ...
PalBo's user avatar
  • 161
6 votes
2 answers
976 views

Repeat char n times in zsh prompt

I'm working on a custom ZSH prompt and I want to repeat a char n times in a string (such as spaces for padding). This string is printed with print -rP (the -r flag ignores echo escape conventions and ...
Moarram's user avatar
  • 63
1 vote
0 answers
39 views

Color escape codes showing up instead of colors in PS1 prompt [duplicate]

I'm trying to set up my prompt to conditionally display whether I am in a git repo, and if so, to display the branch. And I want it color coded, so I have it use some color escape sequences to make it ...
Alex's user avatar
  • 111
1 vote
1 answer
2k views

Displaying icons for directories in zsh prompt

This is, roughly, my left prompt for zsh: # Libraries autoload -Uz colors && colors # User color if [ "$(whoami)" = "root" ]; then COLOR="red" elif [ "$(...
user avatar
0 votes
0 answers
410 views

Conditional zstyle format (color) for git branch name in zsh prompt (using prezto)

I am switching to zsh from bash and one thing that I'm used to is having the git branch name in my prompt coloured to reflect whether the branch is clean or not. So if my branch is main and it's clean,...
dpwr's user avatar
  • 109
1 vote
1 answer
363 views

bash prompt doesn't re-draw properly on resizing window

Basically I have a bottom bar that always shows me the current directory on the left and on the right side the git branch. I tried to use powerline, but it only works by having a bar above the prompt, ...
Bo Chen's user avatar
  • 11
2 votes
1 answer
130 views

Is it possible to use the escape codes used in shell prompts elsewhere, such as with echo?

Example: When I run echo -e "\[\033[;33m\][\t \u (\#th) | \w]$\[\033[0m\]" the printed response is \[\][ \u (\#th) | \w]$\[\] where everything after the first \[ and before the last \] ...
Lukas's user avatar
  • 47

1
2 3 4 5
13