3 ms·
chattr +a ~/.bash_history
by heyrhett 11y ago
chattr +a ~/.bash_history
- voltagex_ 11y agoWhat does this do?
- fabulist 11y agoAfter some experimentation, it makes a file impossible to delete. Very clever, +1.
- voltagex_ 11y agoI wonder if this solves the issue of multiple bash instances clobbering history.
- dllthomas 11y agoFrom the bash manpage: If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten. histappend If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file.
- voltagex_ 11y agoI always seem to get this wrong or forget to set it up in my bashrc. I'll add it to my dotfiles repo, thanks.
- voltagex_ 11y agohttp://askubuntu.com/a/80380/288724 http://askubuntu.com/a/80380/288724 looks like it might be my issue, specifically > The bash session that is saved is the one for the terminal that is closed the latest.
- dllthomas 11y ago`man chattr` says: "A file with the `a' attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute."
- roghummal 11y agounset HISTFILE