As per title, where can I find the globally accessible history exactly?
I have learned to use rpc:call
to the current group leader with the group_history
atom but that doesn’t tell me where the actual items are stored.
(And I think I seen somewhere that disk_log
is responsible for managing them?)
2 Likes
max-au
October 29, 2022, 3:08pm
2
See the shell documentation:
A history mechanism saves previous commands and their values, which can then be incorporated in later commands. How many commands and results to save can be determined by the user, either interactively, by calling history/1 and results/1, or by setting the application configuration parameters shell_history_length and shell_saved_results for the STDLIB application. The shell history can be saved to disk by setting the application configuration parameter shell_history for the Kernel application.
Depending on shell_history
configuration parameter it could be your custom module, or the default group_history
module. The latter, in turn, uses shell_history_path to find saved history on the disk.
4 Likes
Thank you. I know this is unrelated but I am working with Elixir and I can’t access the docs of kernel
or group_history
in iex
.
I also tried to look for group_history
module docs on erlang.org and failed. Can you please point me at it?
EDIT: Maybe this? erlang-history/group_history.erl at master · ferd/erlang-history · GitHub
1 Like
Well, at least on my Mac I eventually found the history inside the ~/Library/Caches/erlang-history/
directory.
1 Like
max-au
October 30, 2022, 3:07am
5
Source code is here: otp/group_history.erl at master · erlang/otp · GitHub
So technically if there is no value set for shell_history_path
, it’s filename:basedir(user_cache, "erlang-history")
1 Like
nzok
October 31, 2022, 6:40am
6
The location is reported by
filename:basedir(user_cache, “erlang-history”)
which for my Linux box is ~/.cache/erlang-history
3 Likes