Section 6:50. Hive CLI History and .hiverc

The Hive CLI provides a command history feature that allows you to access the history of previously executed commands. You can access the command history in the following ways:

  1. Use the up/down arrow keys: In the Hive CLI, you can use the up/down arrow keys to navigate through the command history. Press the up arrow key to go back to previous commands and the down arrow key to go forward to more recent commands.
  1. Use the history command: You can also use the history command to display a list of previously executed commands and their line numbers. For example, history displays  a list of the most recent commands with line numbers, and !5 executes the command on line 5 of the history.
  1. Use the !string syntax: You can also use the !string syntax to execute a command from the history that matches a specific string. For example, !hive executes the most recent command that contains the string “hive”.

The Hive CLI stores the command history in a file named .hivehistory in your home directory. You can also configure the maximum number of commands to store in the history file by setting the hive.cli.history.max property. By default, the history file stores up to 1,000 commands.

Share this post