Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why the line history limit, though?

I do not want that my lines get deleted silently. ever. I would rather prefer that random files on my disk are deleted, before that. Is there any shell without line history limit?



History is limited because very large history files could make the shell slow! Shells are often used to recover from exceptional conditions (out of disk space, `rm -rf /`, etc) so it's important they be responsive no matter what.

bash's history limit is by default the last 500 commands, without considering duplicates. In practice this limit is easy to exceed, which is why bash config guides recommend upping it.

fish's history limit of 2^18 (~256k) commands is really more of a sanity check. Duplicate commands are counted only once, and commands are discarded by LRU (not oldest). This means history only starts being dropped after hundreds of thousands of unique commands. If you in fact run that many distinct commands, I'd love to hear more about your use case!


Bash is still very responsive with 150k+ history entries. The only noticeable performance impact is increased startup time when the history file is not in disk cache.


I made a hack that gives me an SQLite database of command line history for bash https://github.com/trengrj/recent


You may want to read through this [0], for a better understanding of why these limits exist, and how the high limit in fish might be enough for you.

[0] https://github.com/fish-shell/fish-shell/issues/2674


Um — I'd rather not that random files on my disk be deleted. :P Rather have a history line limit in my shell.


In bash, you can remove the limit by setting:

    export HISTSIZE=-1
    export HISTFILESIZE=-1
When the history file is not in the disk cache, startup time will increase noticeably after a while though (think a second, maybe two).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: