0

Web search found e.g. https://askubuntu.com/questions/624848/view-history-of-commands-run-in-terminal, from which I understood there is the file ~/.bash_history and the temp history.

I have many terminals open and want to find out specific output, history shows me command I've interested in. Any way to find out what tty it was run in?

P.S. bash history where command run discusses folders in file system for where.

1
  • ps may be able to provide that information if you're talking about active processes.
    – Seamus
    Oct 21, 2023 at 23:18

1 Answer 1

1

You can't identify this retrospectively from the bash history file. However, you might get somewhere with lastcomm if it's installed and active.

Going forward there's nothing stopping you having different history files for different terminals. Put this into your ~/.bashrc (and maybe your ~/.bash_profile or ~/.profile too):

# Per-terminal history files
[ -n "$HISTFILE" ] && tty=$(tty 2>/dev/null) && HISTFILE="$HOME/.bash_history${tty//\//_}"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .