Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-18-2015, 02:27 AM   #1
Registered: Nov 2011
Posts: 52

Rep: Reputation: Disabled
history command

I have noticed that if I entered "space" before the command I am welling to execute! it will not appear in #history command

how to fix this bug ?
Old 05-18-2015, 02:47 AM   #2
Senior Member
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,849
Blog Entries: 36

Rep: Reputation: 455Reputation: 455Reputation: 455Reputation: 455Reputation: 455
Depends on how you have your bashrc configured. It's not a bug but a configuration and a non-default one at that. Take for example the following from my bashrc.

export HISTIGNORE="&:ls:[bf]g:exit:history:history2"
export HISTCONTROL="ignorespace:ignoredups:&:ls:[bf]g:exit:history:history2"
The HISTCONTROL environment variable, specifically the value ignorespace, will ignore commands that start with a space. From the bash man page,

A colon-separated list of values controlling how commands are saved on the history list. If the list of values includes ignorespace, lines which begin with a space character are not saved in the history list. A value of ignoredups causes lines matching the previous history entry to not be saved. A value of ignoreboth is shorthand for ignorespace and ignoredups. A value of erasedups causes all previous lines matching the current line to be removed from the history list before that line is saved. Any value not in the above list is ignored. If HISTCONTROL is unset, or does not include a valid value, all lines read by the shell parser are saved on the history list, subject to the value of HISTIGNORE. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of HISTCONTROL.
It's definite that you're configuring HISTCONTROL=ignorespace somewhere in your bash configurations. See the man page for what files bash loads as configuration.

Last edited by sag47; 05-18-2015 at 02:49 AM.
Old 05-18-2015, 10:06 AM   #3
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 3,514

Rep: Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545
The setting could also be "ignoreboth", which is just shorthand for "ignorespace" and "ignoredups".


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does BASH history command have no history when run in script ? lump_of_lard Programming 4 01-30-2015 09:45 AM
history command nabendu Linux - Software 6 12-26-2014 09:26 PM
[SOLVED] timestamp of command history doesn't show time command was executed? UprLftCstr Linux - Newbie 3 04-17-2014 12:31 PM
[SOLVED] Is there any command to delete bash command history? cola Linux - Newbie 4 06-01-2010 07:32 AM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 02:14 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration