Is it possible for the Bash prompt to contain a bell without it getting corrupted by navigating history? timmerman@devcees:~$ export PS1='\u@\h:\w$\a ' timmerman@devcees:~$ pexport PS1='\u@\h:\w$ ' timmerman@devcees:~$   Using the arrow keys to navigate the history, the first p from a python3 command got stuck at the end of the prompt but doesn't count for the actual (not visual) cursor position. Looks like a Bash bug. Can it be fixed without recompiling Bash?
64134
When I try to colorize the bash prompt like this:  export PS1="\e[0;31m[\u@\h \W]\$ \e[m "   it breaks the carriage return (instead of going to a new line when line is full, it starts in the same line and erases the input text).  If I remove the color sequence it works fine. I use Ubuntu 11.10 and terminal (guake has the same bug too).
101254
it seems my bash-completion got corrupted. Every time I try to use command substitution, for example when I type  ls $(ls Deskto&lt;Tab&gt;   ..result is..  ls $(ls Desktobash unexpected eof while looking for matching ")".   I tried removing my .bashrc file and cp /etc/skel/bashrc ~/ to get a new one. That works until I add something into my new bashrc. Even when I do echo '#" &gt;&gt; ./.bashrc it breaks again. Removing my bash_aliases did not help either.  Also sudo apt-get install --reinstall bash-completion did not do the trick.  However there are some threads about similar problem, nothing works.  ANY hint will be greatly appreciated! :)
33221
If I want to disable beep sounds from stuff like bash, I add this line to "/etc/inputrc":  set bell-style none   Sadly, this doesn't work for some other events like GDM start-up and shut down. I thought that adding this line to "/etc/modprobe.d/blacklist.conf" would help:  blacklist pcspkr   That makes me wonder and doubt where the sound actually comes from.
44046
There are a number of tutorials/posts online (e.g. ) about how to customize your prompt in bash by setting PS1.  Is there a way to customize the color/bolding of the command I type?    In other words, as an example lets say that I wanted a green prompt, a bold blue command, and then output in whatever colors would be default.  In the example below, I already know how to make "joe&gt;" show as green, blue, bold, whatever by setting PS1.  But is there a way I can I make git status show as bold for example?  joe&gt; git status # On branch master # Your branch is ahead of 'origin/master' by 2 commits. # ...
50610
Using bash, I save my history with the timestamp.   How do print the history omitting the timestamp?   alias h=history alias g=grep -i   To find lines that I used for heroku, I type:  &gt; h | g heroku   I'd like to unique the results without the time-stamp, naturally.  This question is somewhat related:   However, sometimes I want to see the duplicate in the history to see the context under which a command was run.
30693
I often find myself in the following position: I've started typing a long command at the bash prompt, but half-way through I find out I need to check something with another command. This is a problem when I'm at the console (no X), which is often the case, because then I only have the following unsatisfactory ways to do it, that I know of:    Hit ctrl+alt+F2 and log in on another virtual console, and find out what I wanted, then go back and continue  ctrl+a, type echo + space + enter, find out what I wanted, press ↑ until I find my command, ctrl+a, del x 5, ctrl+e, and continue  Highlight what I've typed so far with my mouse (if gpm is running, which it usually is), press ctrl+c to interrupt, find out what I wanted while being careful not to use my mouse to highlight stuff, then press middle mouse button on a new prompt and continue  Pray to the command line gods that the half-written command will have no adverse effects but simply fail, and gingerly press enter, then find out what I wanted, press uparrow until I get my command back, and continue  Jump into my time machine, travel back in time and remind myself to start screen before starting to type command, travel back to the present, press ctrl+a c, find out what I wanted, press ctrl+a ctrl+a, and continue   So what I want to know is, is there some more elegant way of doing this? A sort of subshell-command or similar?  I'm most interested in methods that do not require any preparations or setup to work.
86371
I admit that I use a somewhat long-winded bash prompt:  --(username)-(Wed April 01|12:00:00)--(~ $  Recently, I got the bright idea to change it so that depending on the exit value from the previous command, if success, the interior elements of the ()'s would be green, and if failure, they would be red.  I got it working for the most part (some odd exit statuses will change the color to something else, but I'm ok with it), but when typing a command which is more than one line, and causes the terminal to scroll, the prompt disappears!  My prompt worked fine when there was no color, so I'm guessing it is related to my color escaping, and particularly my unclosed ['s, but I can't pin it down.  #.profile export PS1='--(\e[$((32-${?}))m\u\e[0m)-(\e[$((32-${?}))m\d\e[0m|\e[$((32-${?}))m\T\e[0m)--(\e[$((32-${?}))m\w\e[0m \$ '  Thanks in advance!
56616
I have an issue with my terminal prompt line. When the line is too long it wraps on the same line and then Up arrow makes it look even worse.   I have already checked , but it looks like I am apparently closing all the squared brackets for non printable characters.  This is my PS1:   \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot) }\[\033[01;36m\]\u@\h\[\033[00m\]\033[01;34m\]\w\033[00m\][$(type __git_ps1 &gt;/dev/null 2&gt;&amp;1 &amp;&amp; __git_ps1 "(%s)")]   Consider this as my standard prompt line   MELISC@work~/dev/bin_tools[((main))]   I was able to get  assdasdasdasdasdadasdsadadasdaddasdadadasdadsadasdsa((main))] asdsadsadsadsadasdasdassdasdasdassdasdassdasdasdasdasdasdasdsadsad   I have already checked my .bashrc  I have and shopt -s checkwinsize should autocheck the columns
41078
I've found some special parameter with Bash starting with $ sign. Example: When I was wandering for exit status I knew about $?, process ID  $$ etc. So, I am sharing  this post to know which are special bash (shell) parameters and their usage.
97275
I define a shell keybinding in my ~/.bashrc like so:  bind -x '"\e\C-w":"/usr/bin/reset"'   This does make Ctrl-Alt-w launch the reset executable. However, it leaves the terminal in a state that resembles the one you get into by pressing Ctrl-v. So, for example, if immediately after resetting in this way I press Ctrl-p, instead of invoking the action of that shortcut (repeat previous command) I get ^P printed.  Any idea what's causing this problem and how to fix it?  EDIT: I am attaching a Python program that reproduces the messed-up terminal state I am trying to fix with the reset. I encounter this condition very often while debugging multi-threaded applications:  import pdb, thread, time  def interrupt():     time.sleep(2)     pdb.set_trace()  thread.start_new_thread(interrupt, ()) raw_input('? ')   To reproduce the messed-up state, just run the code above, and press Enter when you see the debugger invoked (it will print a bunch of text, ending with pdb.set_trace(), about two seconds after you run the program and the initial prompt appears).
81768
Consider the simple script hello:  #!/bin/bash  echo 'hello world!'   Now from bash if I try to run this in the background:  $ hello &amp; [1] 12345 $ hello world! █ &lt;--- prompt is stuck here until I hit enter! [1]+ Done $ █ &lt;--- prompt back to normal   What I would rather see:  $ hello &amp; [1] 12345 [1]+ hello world! [1]+ Done $ █ &lt;--- prompt normal the whole time   How can I change the behavior?
104203
I recently rent a VPS and generated a public/private key pair and transferred it to my server (added it there to the authorized_keys file) ...  So far on my first login via terminal on OSX I got asked for my passphrase and declined to save it to my keychain.  However my terminal won't prompt for the passphrase anymore, instead I can connect instantly via "ssh myserver.com" ...  I can't find the key in my keychain (why should I) and can't figure out why it's not asking for my passphrase!  EDIT: Ok, after a restart of my macbook I get the prompt again. One time. It seems it saves it temporarily ... I do not want that
19648
abhigenie92@ubuntu:~$ (sleep 2; echo $BASH_SUBSHELL ;sleep 2) 1 abhigenie92@ubuntu:~$ (sleep 2; echo $BASH_SUBSHELL ;sleep 2)&amp; [1] 3297 abhigenie92@ubuntu:~$ 1  [1]+  Done                    ( sleep 2; echo $BASH_SUBSHELL; sleep 2 )   What happens when launch it as a background process, why don't I get the prompt back and I have to press Enter? In both cases it launches a child shell.
27410
I am using  to show the branch name in gnome terminal (Ubuntu 15.10) when working in a git repository. Based on the above I now have the below in my ~/.bashrc file:  # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes    ...  # Add git branch if its present to PS1 parse_git_branch() {  git branch 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } if [ "$color_prompt" = yes ]; then  PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' else  PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' fi unset color_prompt force_color_prompt   As a result I now get:    so it works. But why has the coloring of my user@host been removed? And I would also expect that the branch name should be colored. Before it looked like this:    UPDATE: I have now tried this guide instead:    adding this to .bashrc:  parse_git_branch() {      git branch 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "   and that works:    Notice in .bashrc I also have this (default):  # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes   I have yet to find the reason why that snippet gives the correct result and the other version does not. Any input on this?  Here is the version of my .bashrc that has the old snippet enabled that does not work:
94555
I've just executed a long-running process from the bash prompt. In hindsight, I wish I'd run time on it, or noted down the time at which I kicked it off.  Is there any way of getting this information retrospectively? The .bash_history doesn't seem to include timestamps.  In my particular case it's Mac OS X, but I'm interested in general Unix/Linux solutions.  To clarify, the process has now completed, and I'd prefer not to run it again unless absolutely necessary!
98335
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 echo "@@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@" echo "our-platform-7.26-2.17-res4" read SuggestDefaultPlatform  echo "Stored name: " ${SuggestDefaultPlatform}   which prompts:  @@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@  our-platform-7.26-2.17-res4 _   where the underscore "_" stands for the cursor.  I don't want to use a "Y/n" logic workaround, assigning a default value to the "SuggestDefaultPlatform" variable  SuggestDefaultPlatform='our-platform-7.26-2.17-res4';   and then prompt a question like:  Are you okay with `'our-platform-7.26-2.17-res4'` as your platform name? [Y/n]...   Instead the user might want to change just a few digits of a prompted suggestion and press Enter. See below the cursor "_" at the end of the "SuggestDefaultPlatform" variable:  @@@@@@@@@@ @ Enter the new plarform name [for example: our-platform-7.26-2.17-res4]: @@@@@@@@@@  our-platform-7.26-2.17-res4_   so that the user can move the cursor, modify the suggestion and/or press Enter.  our-platform-7.26-2.17-res_ our-platform-7.26-2.17-re_ our-platform-7.26-2.17-r_ our-platform-7.26-2.17-_ our-platform-7.26-2.17_ our-platform-7.26-2.1_ our-platform-7.26-2.18-alpha1_   Press Enter.  which prompts:  Stored name: our-platform-7.26-2.18-alpha1
94156
Open a prompt, try to do this:   type this code: export PS1="\e[1;30m-30-\e[m &gt;" copy it with your mouse (select the code + copy it (I have auto-copy when I select with the mouse enabled)) close the prompt open a brand new prompt immediately paste it (SHIFT INS) type "HOME" key and "END" key, you'll see the cursor go to logical positions (start and end of the code) now press ENTER you prompt changes the colors immediately paste it (SHIFT INS) type "HOME" key and "END" key, you'll see the cursor go to illogical positions (offset problem)   This means if I apply colors to the prompt I can't copy/paste + change my copied code...   NB: I'm asking it here because I thought it was a problem of  but it seems it's only related to what I'm trying to assign: export PS1="\e[1;30m-30-\e[m &gt;"... and I dont see a problem. It should just change the colors of the prompt (and that's what it does actually). But it seems it does something more I dont see. Does somebody know what it could be?