Ubuntu – centralized history file for all the commands run from various terminals

bashcommand linehistory

I am aware that every terminal has it's separate history,which can be viewed by the history command. Commands issued on suppose terminal tty1 will be shown in the history of tty1 only and not in the history of any other terminal suppose tty2.

Is there a file which stores all the commands fired from various different terminals; irrespective of the terminal type (tty,pts1).

Best Answer

Command History is generally a feature provided by bash, and is stored per-user in the .bash_history file in your home directory.

While the history command may show you different histories in different terminals while those terminals are open, they will all be merged and written to the common ~/.bash_history file once you exit the terminals.