I'm using FreeBSD 11, and Bash as my shell. I've checked all the basics.

  • History shows as "on"
  • HISTFILE, HISTFILESIZE and HISTSIZE are all set with sensible values.
  • $HISTFILE exists and has rw permissions and a size of 9 bytes (ls -lt $HISTFILE)

That should be all that's needed. Yet there we sit. history shows nothing. Not a single line is held in the shell, and command history refuses to work.

What else can I try, to get history working?

  • After removing $HISTFILE, does it get recreated when you open a new bash shell? – Steven Oct 9 '17 at 18:37
  • No. I've deleted and tried. Nothing funny in the bashrc file. Also rechecked by setting HISTFILE as a file in /tmp while su, so it shouldn't be a permissions issue either. It isn't creating the file and it doesn't seem to be keeping history in shell memory for writing out later, but the file is valid as can be seen because I can manually create it when bash doesn't, using the same variable to be sure its not a typo (touch $HISTFILE and chmod 0666 $HISTFILE): both work, the file then shows in ls -lt and yet still no history, even on starting another session. – Stilez Oct 9 '17 at 19:42
  • Is histappend set? Can you check the output of shopt? – Michael P Mar 6 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.