Kile writes cd <working dir> clear in .bash_history every time the live preview is compiled after saving, if the live preview behaviour is set to "compile after saving". Note that if the live preview is set to compile whenever changes have been made, it only writes the above two lines at launch (and not at every compilation of the preview). This certainly is related to https://bugs.kde.org/show_bug.cgi?id=265165, which has been closed for years. Step to reproduce: 1- Set live preview to compile every time you save 2- Open a file, modify it and save it (so that the live preview is updated). 3- Close Kile and look at .bash_history.
I'm guessing the problem still comes from the built in konsole as typing history -c in this one prevent the lines to be added to bash_history. I'd suggested to replace "clear" by "clear && history -d -1 && history -d -1".
Git commit cef2d4888250581420a7909bad5644a9c3c8dedb by Nicolas Fella, on behalf of Alessio Bonfiglio. Committed on 27/06/2022 at 23:36. Pushed by nicolasfella into branch 'master'. Add white space before console commands in order to avoid save them into bash history This avoids saving the `cd` and `clear` commands into the bash history if `ignorespace` is set in bashrc Dolphin and Kate do the same in their Konsole integrations Related: bug 453935 M +2 -2 src/widgets/konsolewidget.cpp https://invent.kde.org/office/kile/commit/cef2d4888250581420a7909bad5644a9c3c8dedb