Linux
我的 $HOME 文件夾中奇怪的空 bash_history-*.tmp 文件
.bash_history-*.tmp
在我不知情的情況下,我的主文件夾中有 169個是在同一天(2021 年 4 月 16 日)創建的。文件只有所有者的讀寫權限。我不確定是什麼導致了這種情況發生。在我的 Linux 之旅(桌面和伺服器)的 5 年中,它從未發生過。更奇怪的是,我的預設 shell 不是 bash 而是它的zsh
. 如果有人可以幫助我弄清楚實際發生了什麼(如果可能的話)或者以前發生在其他人身上,那就太好了?先感謝您。這裡是.-(~)(user@host) `-->> find . -name '.*.tmp' -rw------- 1 user user 0 Apr 16 17:40 .bash_history-01407.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-01810.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-02487.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-03675.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08255.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08260.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08283.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08326.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08434.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08450.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08550.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08581.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08649.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08676.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08683.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08697.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08698.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08712.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08717.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08742.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08743.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08819.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08841.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08878.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08884.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08904.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08914.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-08962.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09060.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09116.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09157.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09201.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09212.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09228.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09247.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09248.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09265.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09274.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09283.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09331.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09366.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09397.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09445.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09501.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09507.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09548.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09597.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09632.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09701.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09760.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09904.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-09992.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10059.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10158.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10166.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10170.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10320.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10536.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10594.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10631.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10714.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-10753.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11127.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11189.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11494.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11514.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11697.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11774.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11827.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-11973.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12002.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12266.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12316.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12331.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12357.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12377.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12393.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12399.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12400.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12405.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12413.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12417.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12435.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12475.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12513.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12563.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12644.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12648.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12656.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12743.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12779.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12801.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12803.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12817.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12868.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-12971.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13005.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13013.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13020.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13033.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13042.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13047.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13065.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13074.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13089.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13090.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13092.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13094.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13097.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13099.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13145.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13162.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13184.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13202.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13203.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13206.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13208.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13218.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13219.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13220.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13250.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13313.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13316.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13320.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13322.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13323.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13341.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13360.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13388.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13489.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13530.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13566.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13575.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13576.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13630.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13640.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13675.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-13717.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14153.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14156.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14167.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14204.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14254.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14256.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14265.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14267.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14331.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14332.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14359.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14368.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14693.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14792.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14922.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14923.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14928.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14931.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14933.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14943.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14947.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14951.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14955.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-14968.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-30961.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-31005.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-31110.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-31142.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-32057.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-32358.tmp -rw------- 1 user user 0 Apr 16 17:40 .bash_history-32434.tmp
僅供參考:有人幫我在archlinuxforum上找到了類似的文章,但它沒有回答我的問題。
源(在 Debian上
bash
可用apt-get source bash
)使用文件中的函式寫入其歷史history_do_write
文件bash-5.0/lib/readline/histfile.c
。它創建一個臨時文件,將歷史行寫入該文件,然後使用它來替換實際的歷史文件tempname = (overwrite && exists && S_ISREG (finfo.st_mode)) ? history_tempfile (histname) : 0; output = tempname ? tempname : histname; ... if (rv == 0 && histname && tempname) rv = histfile_restore (tempname, histname);
在許多地方寫入可能會失敗,在這些情況下,臨時文件被取消連結(刪除)並且原始文件被單獨保留。
但是,您在路過的評論中提到您執行了一個 forkbomb。這很可能是這些臨時文件的根本原因。有可能由於不受控制的分叉炸彈觸發的極端記憶體和程序壓力,
bash
即使是這個恢復過程也無法獲得足夠的臨時記憶體來完成,並且在嘗試更新期間簡單地崩潰了。(請注意,這不是硬事實,只是一個假設。)