From time to time I find that when I copy/paste a command from a web page (or from the Terminal window itself) the pasted command is not recorded in bash history. For example, just now I did this:
cd foo
git push --set-upstream origin master
cd ../foo2
git push --set-upstream origin master
cd ../foo3/
git push --set-upstream origin master
cd ../foo4
git push --set-upstream origin master
(Note: I typed the cd
commands manually - the git push
commands were pasted).
However when I type history
I see this:
2008 cd foo
2009 cd ../foo2
2010 cd ../foo3/
2011 cd ../foo4
2012 history
Bash version:
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
Linux version:
Ubuntu 14.04 LTS
Terminal version:
Gnome Terminal 3.6.2
This is kind-of annoying, because for one thing history
does not show exactly what I did. Secondly, I can't just up-arrow to recall the command I just pasted.
Why is it doing this, and how can I stop it?
git push
) and got an error message, suggesting that I dogit push --set-upstream origin master
. The message (from git) was indented like that (I may have the exact number of spaces wrong because the history pushed the message out of the terminal window). I copied the entire line, so some leading spaces are there. – Nick Gammon May 08 '16 at 23:41export HISTCONTROL=""
in .bashrc would do the trick. – Jeff Learman Aug 07 '18 at 00:14