readline.get_current_history_length()

Return the number of items currently in the history. (This is different from get_history_length(), which returns the maximum number of lines that will be written to a history file.)

Related Reading

readline — GNU readline interface