EDIT: I figured out what went wrong! The root cause of it was my .bash_history file; that contained the commands!



I've configured my fish shell to clear my fish history (because of personal preference). This is my ~/.config/fish/config.fish file:

echo "" > ~/.node_repl_history
echo "" >~/.pry_history

fish_vi_key_bindings
builtin history clear

if test -e ~/.profile
        source ~/.profile
end

My node and pry history files do get cleared, I have vi mode in the shell and my .profile gets sourced (because that apparently doesn't happen automatically).

Where it gets interesting is this: most of my fish history does in fact get cleared. but about 4 or 5 commands always persist in the history, and i'm not quite sure how. I found out that the file .local/share/fish/fish_history contains these mystery commands, but even after I cleared the file and changed its permissions to read-only; or even deleted it(!) and ran fish again in a new session, the commands were revived and in my history once again.

I do not find them in any other fish history file, for any user, only my own.

Any help on this would be greatly appreciated. Thanks in advance,

Ethan.

  • What are these mystery commands? And why are you sourcing ~/.profile? Does that file contain fish commands? – glenn jackman Oct 7 at 13:28
  • @glennjackman my .profile contains common things shared by many shells like aliases and setting my PATH and so on. The "mystery commands" are: - cmd: hwinfo --framebuffer when: 1538919880 - cmd: hwinfo --framebuffer > temp.txt when: 1538919880 - cmd: cat temp.txt when: 1538919880 - cmd: rm temp.txt when: 1538919880 - cmd: exit when: 1538919880 (contents of my fish history in the local share folder) – Ethan Oct 7 at 13:43
  • Is your .profile sourcing other files? It seems unwise to have different languages sourcing a common file – glenn jackman Oct 7 at 15:18
  • No the .profile doesn’t source anything else – Ethan Oct 7 at 15:38
  • @glennjackman figured it out (see the edit) – Ethan yesterday

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.