Skip to main content

Questions tagged [prompt]

The prompt is what asks a user for their interactive input

Filter by
Sorted by
Tagged with
113 votes
6 answers
43k views

What is the origin of the UNIX $ (dollar) prompt?

The UNIX prompt uses a $ symbol to indicate that your input is expected. I was wondering why this symbol was chosen—if there is a reason. Dollar just seems a little unexpected. A > symbol would ...
108 votes
8 answers
134k views

Avoid password prompt for keys and prompts for DN information

I am using following code to generate keys: apt-get -qq -y install openssl; mkdir -p /etc/apache2/ssl; openssl genrsa -des3 -out server.key 1024; openssl req -new -key server.key -out server.csr; cp ...
user avatar
76 votes
5 answers
140k views

How can I display the absolute path in bash prompt?

I currently have my bash PS1 set to something like this: PS1="\[\`if [[ \$? = "0" ]]; then echo '\e[32m\h\e[0m'; else echo '\e[31m\h\e[0m' ; fi\`:\w\n\$ " How can I make it show the absolute path ...
David B's user avatar
  • 2,554
69 votes
1 answer
35k views

How can I block the “Sign in with Google” prompt on websites? [duplicate]

On many websites that require login, those annoying Google login prompts appear: There are several tutorials on the Internet on how to avoid this, for example, this one on How-To Geek, which suggest ...
jay.sf's user avatar
  • 821
50 votes
4 answers
248k views

Schedule a task with admin privileges without a user prompt in windows 7

In windows 7, I'd like to schedule a program to be run with administrative privileges, without having the user need to respond to a prompt (which requests elevated privileges) every time the scheduled ...
notAlex's user avatar
  • 607
45 votes
4 answers
20k views

Tmux and ZSH custom prompt : bug with window name

I have customized my ZSH prompt with oh-my-zsh to make it more readable and add information about git if I'm in a repository. Example : bob@inf [~/docs] % bob@inf [~/src/nicest] master % (in a git ...
Adrien Coquio's user avatar
45 votes
7 answers
20k views

Why does this bash prompt sometimes keep part of previous commands when scrolling history?

My bash prompt, which I'll admit to have stolen from a few places and cobbled together, will sometimes add part of previous commands to its length when scrolling the bash history with up/down arrows. ...
Caleb Hearth's user avatar
33 votes
3 answers
49k views

How do I hide the path in command line prompt on Windows?

I'm working on Windows 7 using the cmd console. How do I hide the path in the prompt?
Chris's user avatar
  • 1,109
30 votes
2 answers
46k views

How can I put a newline in my zsh prompt without causing terminal redraw issues?

I'm trying to fix a minor (but annoying) issue with my zsh prompt. The problem I'm seeing is that when I'm using a terminal in a GUI OS environment (for example, Terminal.app or iTerm 2 on OS X 10.7.2)...
user avatar
29 votes
4 answers
10k views

Escape non-printing characters in a function for a Bash prompt

In a Bash Prompt (PS1 variable), I'm calling a function to potentially add text to the prompt: export PS1="\u@\h \$(my_function) \$ " However, the function in the prompt contains ANSI color codes ...
MidnightLightning's user avatar
28 votes
4 answers
34k views

CMD prompt window pops up and instantly disappears periodically

Windows 10 - Every 10 minutes or so, a command line window flashes on my computer. I'm afraid I may have been infected by something. I've been staring at the Task Manager (and process explorer) for ...
boscher50's user avatar
  • 601
28 votes
9 answers
35k views

Right align part of prompt

I am sure that I have seen someone have a part of their prompt aligned to the right in their terminal window and then have the actual cursor start on a second line. I know that I can achieve the ...
Felix Andersen's user avatar
24 votes
3 answers
118k views

Why doesn't "cd D:" change the command context to D:? [duplicate]

Possible Duplicate: Using cd Command in Windows Command Line, Can't Navigate to D:\ Every time I want to change directory context to another drive (D, E, F, or whatever..) on a Windows ...
Diogo's user avatar
  • 30.5k
24 votes
6 answers
119k views

How to Run an app as Administrator without the prompt?

When I start SQL Server Management Studio 2008, I get an error that's been around forever and is documented here. One of the suggestions to fix it that actually worked was to start SSMS with Run as ...
AngryHacker's user avatar
  • 18.7k
24 votes
5 answers
20k views

MySQL command line color prompt

I want to add colors to the MySQL command line color prompt. I have so far in a script (database.sh): mysql -uroot -hlocalhost -A --prompt="\u@\h:\d> " I would like root to be red, @ to be blue, ...
EscoMaji's user avatar
  • 341
23 votes
3 answers
16k views

Get Function Into PS1 (Zsh)?

This works in bash (parse_git_branch is a defined function) export PS1="\$(parse_git_branch)" But I cannot figure out the equivalent in zsh. Note: If I do PROMPT="$(parse_git_branch)" It seems ...
Dan Rosenstark's user avatar
23 votes
4 answers
13k views

zsh right-justify in ps1

I'd like a multi-line zsh prompt with a right alined part, that will look something like this: 2.nate@host:/current/dir 16:00 -> I know about RPROMPT ...
So8res's user avatar
  • 1,519
23 votes
1 answer
30k views

What is rootfs# and what can you do with it?

I have been dropped to a [rootfs /]# prompt many times when booting my distro failed. Usually I found I couldn't fix the problem with the limited commands available, so I would use any spare Live CD I ...
Wolfizen's user avatar
  • 1,232
22 votes
11 answers
21k views

Pushing my PS1 prompt over ssh

I use a specific "PS1" prompt that I like. I share a few logins with other other people on a few different servers. I was wondering if there was a way to specify in my local bash profile a remote ...
Unfundednut's user avatar
  • 7,130
20 votes
3 answers
19k views

How to leave the execute prompt in zsh

In a zsh, maybe I pressed Alt+X by mistake, but now I'm stuck and this execute: _ prompt won't leave. Pressing Ctrl+C does nothing.  If I press Enter it tries to complete what I typed. Pressing Enter ...
lolesque's user avatar
  • 514
18 votes
3 answers
10k views

Removing the useless space at the end of the right prompt of zsh ($RPROMPT)

In zsh, there is always a space character at the right of my right prompt. I tried with a very simple .zshrc such as: PROMPT="#" RPROMPT="*" There is a always a space after the * on the right of the ...
Frozax's user avatar
  • 315
17 votes
7 answers
11k views

How to show the current Vi mode when using Vi keybindings in the shell?

I use the vi keybindings in my tcsh shell. Now, I don't know which vi mode I'm in (insert mode or command mode), which leads to a lot of frustration. Does anyone know of a way to show the current ...
Sundar R's user avatar
  • 1,489
16 votes
2 answers
9k views

Get current window number for bash prompt

I want to replace status bar with bash prompt displaying window number like ①. How can I get current window number in the shell? There's TMUX_PANE env variable, unfortunately no TMUX_WINDOW. The ...
Wojtek Kruszewski's user avatar
14 votes
4 answers
15k views

How do I fix my prompt in emacs shell-mode?

I'm doing some programming on a colleague's machine. He has a version of emacs (23.1.1) I haven't used before. My problem is that when I go to shell-mode, my bash prompt looks like this: ^[]0;jay@...
Jay Conrod's user avatar
  • 5,660
13 votes
5 answers
6k views

Which directory does path `//` represent in Linux?

When I want to go back to upper level directory in Linux by typing cd .., I typo-ed cd //. To my great surprise, no errors are reported. What's more the prompt becomes username@hostname://$. ls ...
Summer_More_More_Tea's user avatar
13 votes
2 answers
6k views

Why does setting the bash prompt (PS1) manually cause root to have a $ instead of a #?

I'm on CentOS 6.4. By default the root user's prompt has # symbol, i.e. it looks something like [root@myserver ~]# . echo $PS1 prints out [\u@\h \W]\$; but if I do PS1="[\u@\h \W]\$" (which shouldn't ...
stripybadger's user avatar
13 votes
3 answers
5k views

Making Linux shell prompt show last return value

I'm currently on a Linux machine and the shell prompt is showing me the last return value and number of executed commands (picture included, with these numbers shown in purple). My own computer doesn'...
Eran's user avatar
  • 3,459
11 votes
7 answers
99k views

Kill a process which is listening on port 8080

I perform the following on Win7 32-Bit in the command prompt: netstat -ano | findstr 8080 it returns with: TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1896 how might I ...
user avatar
10 votes
2 answers
11k views

Multiline RPROMPT in zsh

I know you can define multiline prompts in zsh: PROMPT=' test → ' But I was wondering, why can't you define multiline right prompts? I tried: RPROMPT=' test still test ' but nothing shows up. Is ...
linkyndy's user avatar
  • 203
9 votes
1 answer
4k views

Display only the current directory name (not the full path) in Windows CMD Prompt

In Windows CMD.EXE, I have my prompt string set to $P$G, so, if my current working directory is C:\Some\long\folder\inner my prompt is like this: C:\Some\long\folder\inner> I want it to show only ...
laggingreflex's user avatar
8 votes
5 answers
23k views

in zsh, how do I get pwd in my prompt?

I've recently switched from bash to zsh, but it annoys me that I can't see what directory I'm in (MacOSX) how do I get 'pwd' to show up in my prompt?
anon's user avatar
  • 311
8 votes
3 answers
8k views

Lightning bolt for prompt (PS1)

I've seen on a few screencasts a while back where someone had a lightning bolt instead of $ on the bash prompt. Does anyone know how to do this?
Wasabi Developer's user avatar
8 votes
3 answers
4k views

Is it possible to get bash to display the first letter of each directory in my working path?

For example working in: /home/stuart/src/project/com/example/package /usr/lib/python2.6 would appear as: ~/s/p/c/e/package$ /u/l/python2.6$
Stuart K's user avatar
  • 183
8 votes
2 answers
4k views

How to change the prompt of mc's subshell

I often use the subshell of mc. So I want the promt of mc-subsell to be different form the primary shell. Say, how can I change the sub-prompt like this: mc:$Current_dir$ many thanks
lymslive's user avatar
7 votes
1 answer
461 views

Custom prompt botched during history and control-a in OS X's Terminal.app using Bash

I customized my prompt in .bash_profile to look like this: export PS1="\w \e[0;32m\$(vcprompt -f '[%n:%b]')\e[m\$ " Now, when I press up arrow to go back through history, find the one I want, then ...
Jed's user avatar
  • 283
7 votes
4 answers
7k views

Windows 7 batch file: Why are these IF blocks keeping me from assigning variables to a value?

Here's the broken batch file: @echo off if prod==prod ( if xps==xps ( set i1=prodxpsi1 set i2=prodxpsi2 set e1=prodxpse1 set e2=prodxpse2 ) else ( set ...
oscilatingcretin's user avatar
7 votes
3 answers
7k views

How to redirect output of a command to a file when the command will prompt user inputs?

I have a command which will prompt user for some inputs and then output the result to the terminal. I typed the command like below to redirect the output to a file: $the_command > abc.txt But it ...
Aaron Shen's user avatar
7 votes
4 answers
6k views

How to prevent password popup everytime for changing network configuration in OS X Mountain Lion?

I have a few network scripts that I used under OS X Lion that automatically created a ssh connection and then changed network configuration on my local machine to run traffic through the ssh tunnel. ...
SudoKill's user avatar
  • 181
7 votes
1 answer
6k views

Right and fast way to test git directory and git branch?

While trying to set up my new fish shell prompt, I ended up testing ways to get the branch name and also testing if I was on a git repository. I have found (1) git rev-parse --abbrev-ref HEAD, (2) git ...
Andrés Botero's user avatar
6 votes
1 answer
2k views

ZSH: change prompt just before command is run

I would like to have a two-line prompt in zsh, but collapse it to a very small one just after pressing ENTER, so that it doesn't show up in the terminal scroll history. After typing two commands, the ...
Suzanne Soy's user avatar
6 votes
4 answers
3k views

On the Windows commandline, how do I get a dynamic prompt that tells me where in the filesystem I am?

I am trying to modify my CMD, to show only the current directory name dynamically, like: Desktop $ When I switch the folder, it must be updated. It is not required to be code in a pure batch file. It ...
guneysus's user avatar
  • 236
6 votes
1 answer
3k views

What's the easiest way to prepend the current time to the fish prompt?

I'd like to see the current time in my fish prompt so that I can always see for example when I started the last command. I don't want to install extensions.
Suzana's user avatar
  • 319
6 votes
0 answers
1k views

Avoiding the `npm login` (`npm adduser') email prompt in npm & jFrog artifactory

When I do npm login (alias of npm adduser) I ALWAYS get prompted for my email address. Username: ... Password: ... Email: (this IS public) ... This is obnoxious. I've done npm config -g set email .....
Jason Kleban's user avatar
5 votes
3 answers
39k views

How to hide commands in the prompt of Windows 10 from a batch file?

I want to hide the commands in the prompt that opened from a batch file. Example: This is how it normally is: This is how I want it to be: It would be good as well if there was a way of output ...
Lucas Souza's user avatar
5 votes
2 answers
3k views

How to fix my bash prompt with long lines?

I have the following bash prompt: YELLOW="\[\033[0;33m\]" GREEN="\[\033[0;32m\]" RESET='\e[0m' export PS1="$GREEN[\W]$YELLOW \$(__git_ps1 \"(%s) \")$RESET\\$ " It looks like this: Which is what I ...
Tamás Szelei's user avatar
5 votes
2 answers
5k views

Bash prompt "variables" not working?

I have added this into my ~/.bashrc, to change the prompt: PS1='[\u@\h \w]\$ ' However, it is not showing what I want. I believe this is meant to show my username and possibly the directory that I ...
user avatar
5 votes
3 answers
7k views

~/.profile not being executed when Terminal opens? [OS X 10.6.8]

Somehow my bash prompt got changed to "elementary:~ steven$" and I want to change it back to the default prompt. I've added the following first to ~/.bashrc then to ~/.profile: export PS1="\s-\v\$ " ...
user avatar
5 votes
2 answers
12k views

How to find the build / UBR / kernel version of Windows 10 using command-line (cmd)

I would like to know the basic commands in prompt windows. Therefore, I want to begin by knowing the command that return details of my operating system like kernel version / build and UBR (Update ...
Soufien Hajji's user avatar
5 votes
1 answer
2k views

git commit hash in zsh prompt

I'd like to see the current commit hash (just the first 8 or so characters) in my zsh prompt. I have this so far: https://github.com/calebmeyer/cpm-zsh-theme/blob/master/cpm.zsh-theme#L3 ...
Caleb's user avatar
  • 161
5 votes
2 answers
3k views

true colors in bash prompt?

Is it possible to use true colors in bash prompt? I'm using iTerm2 on MacOS, which does support true colors. But not sure how I use true colors for my bash prompt. At the moment I'm using tput af <...
ronakg's user avatar
  • 446

1
2 3 4 5 6