I wrote:

>On most of my Fedora systems, bash remembers the last commands entered
>prior to a restart. After the system restarts, a new bash window shows
>the last previous command when I press the up-arrow key and multiple
>presses continue to show previous commands in reverse order.
>
>On one system only, nothing happens when I press that key. On that
>one system after I've entered commands, up-arrow shows the previous
>commands in reverse order as I expect. Except that it doesn't go back
>beyond the first new command after the restart. This happens on each
>new bash window on that system, even after other windows have started
>to respond to the up-arrow key.
>
>I presume some history file is being deleted as a byproduct of the
>restart. But I can't seem to find whatever option controls that
>behavior, perhaps because I haven't used the right name to search for
>it. It clearly isn't the .bash_history file as that file is present
>after a restart (though it doesn't appear to have been updated for
>months). Please clue me in.

Roger Heflin answered:

>Possibilities:
>If HISTFILE is unset or null, the shell does not save the command
>history when it exits.
>You also have HISTSIZE and if that is 0 it does not save history.
>You also have HISTFILESIZE and that being 0 does not save history.
>
>There may be other ways to get no history.   Some sort of bad
>permissions on HISTFILE might do it, especially if it was something
>like the readonly attr setting (lsattr).

Also Patrick O'Callaghan answered:

>If the ‘histappend’ shell option is set (*note Bash
>Builtins::), Bash appends the entries to the history file, otherwise it
>overwrites the history file.

Thanks for these possibilities.

On both the working systems and the one misbehaving, I see:

$  set | grep HIST
HISTCONTROL=ignoredups
HISTFILE='~/.bash_history'
HISTFILESIZE=1000
HISTSIZE=1000

On the working systems I see:

$ ls -l .bash_history
-rw------- 1 dave dave 17552 2026-10-06 12:50 .bash_history
$ shopt | grep ^hist
histappend              off
histreedit              off
histverify              off

On the misbehaving system I see:

$ ls -l .bash_history
-rw------- 1 dave dave 20001 2026-02-02 21:16 .bash_history
$ shopt | grep ^hist
histappend              on
histreedit              off
histverify              off

Yes, I double-checked that result. The histappend variable seems to be
set backwards. With it set on, the .bash_history file is NOT updated.
But it's not truncated, either. The file exists and is not empty so why
don't I get some ancient command when I press up-arrow?
-- 
         Dave Close, Compata, Irvine CA       +1 714 434 7359
       [email protected]              [email protected]
        "My definition of a free society is a society
         where it is safe to be unpopular." -- Adlai Stevenson

-- 
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://forge.fedoraproject.org/infra/tickets/issues/new

Reply via email to