In Ubuntu 24 where is `screen` specific Bash history stored?
2/2
May 13, 9:34am

In Ubuntu 24.04 (and most Linux distributions), the Bash history for the screen command itself is not stored separately from your regular Bash history. However, the history of commands run inside a screen session is stored in the same default location as your regular Bash history, which is:

text
~/.bash_history

Key Details:

  • Bash History: By default, Bash stores command history in ~/.bash_history for all interactive shells, including those inside screen sessions.
  • Screen-Specific Behavior: If you exit a screen session, the commands run inside it are still written to ~/.bash_history when the shell exits (unless HISTFILE is overridden or history is disabled).
  • Temporary History: While a screen session is active, its shell may keep a temporary history in memory, but it is typically flushed to ~/.bash_history upon exit.

How to Check:

  1. Verify HISTFILE: Run echo $HISTFILE inside a screen session. If it points to ~/.bash_history, that’s where the history is stored.
  2. Custom HISTFILE: If you or a script set a custom HISTFILE (e.g., export HISTFILE=~/.screen_bash_history), the history would be stored there instead.

For screen Itself:

  • The screen command’s own history (e.g., commands like :screen -list) is not stored in a file by default. It is only available during the current session.

Note: If you’re using zsh or another shell inside screen, the history file would be different (e.g., ~/.zsh_history).

May 13, 9:34am

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Le Chat can make mistakes. Check answers. Learn more