I want to create a log the commands I create in all the termimals I work in, as explained in this question, Is there some utility or plugin which includes the current directory in the bash history?, and in which others have created their own alternatives, eg https://spin.atomicobject.com/2016/05/28/log-bash-history/ and https://github.com/rcaloras/bashhub-client.

I use tmux and session to organize my work, by using session names and window names. It is possible for them to set shell variables that can be used by the PROMPT_COMMAND to update the history, namely use the session and window names to create an environment variables in said log. I need to be able to set them at will and switch them on or off as necessary.

1 Answer 1


screen sets the environment variables STY and WINDOW to the full name of the session (as shown by screen -ls), and the window number, respectively. Of course, these may change during the execution of the program, and there's no way for screen to update the variables stored inside a subprocesses memory.

  • Is it possible the other way round, other commands to read screen and tmux variables?
    – vfclists
    Apr 27, 2017 at 17:50

You must log in to answer this question.

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