По какой-то причине подсеть была настроена на отказ от пинга. Исправил проблему, теперь проблема решена.
Да, загружает в память (изman bash
):
On startup, the history is initialized from the file named by the variable HISTFILE (default ~/.bash_history). The file named by the value of HISTFILE is truncated, if necessary, to contain no more than the number of lines specified by the value of HISTFILESIZE.
И да, теоретически это может быть проблемой, но в наши дни у большинства машин более чем достаточно памяти для решения этой проблемы. Например, у меня есть следующее в моем~/.profile
:
$ grep SIZE ~/.profile
export HISTSIZE=999999
export HISTFILESIZE=999999
Это заставляет меня хранить 999999 в моей истории. Пока что я здесь:
$ history | wc
109207 637303 4614715
Что дает мне ~/.bash_history
размер файла около 3,7 МБ:
$ ls -l ~/.bash_history
-rw-r--r-- 1 terdon terdon 3846502 Dec 21 18:15 /home/terdon/.bash_history
Это даже близко не заметно на моем ноутбуке с 32 ГБ ОЗУ.
В любом случае, это я. Я решил иметь большую историю, поэтому, возможно, я жертвую крошечной скоростью ради преимуществ, которые дают мне. Если вы этого не хотите, вы можете вместо этого оставить значения по умолчанию (вместо man bash
):
HISTFILESIZE
The maximum number of lines contained in the history file. When
this variable is assigned a value, the history file is trun‐
cated, if necessary, to contain no more than that number of
lines by removing the oldest entries. The history file is also
truncated to this size after writing it when a shell exits. If
the value is 0, the history file is truncated to zero size.
Non-numeric values and numeric values less than zero inhibit
truncation. The shell sets the default value to the value of
HISTSIZE after reading any startup files.
HISTSIZE
The number of commands to remember in the command history (see
HISTORY below). If the value is 0, commands are not saved in
the history list. Numeric values less than zero result in every
command being saved on the history list (there is no limit).
The shell sets the default value to 500 after reading any
startup files.
Таким образом, размер по умолчанию составляет всего 500 команд, что на современных машинах ничтожно мало. Если даже это слишком много, вы всегда можете установить его ниже.