I'm trying to record my tmux session. I've got an alias record-session which executes command from ttygif ttyrec ~/ttygif/files/last-session. As far as I understand ttygif starts new terminal instance and starts recording it. Normally I have to do

$ record-session
$ tmux a
# Do something with tmux here
# C-b D
$ exit #to finish recording

But I'd like make it a little bit more automatic becuase I don't like how it's recorded everytime when I type tmux a. I want to make an alias which would start recording and then attach to tmux session. I've tried:

  • record-session ; tmux a
  • (record-session ; tmux a)
  • record-session & tmux a
  • record-session && tmux a
  • record-session | tmux a
  • (tmux a ; record-session)

Each without success. Every one of these commands starts the recording right after I close the tmux or doesn't record it at all.

Any ideas what is the right way to do it?

  • 2
    How about letting ttyrec start tmux: ttyrec -e "tmux a" logfile?
    – FelixJN
    Aug 19, 2015 at 8:39

2 Answers 2


There are more than one solutions here:

There are probably more ways to do it, but best way IMHO would be to use the plugin.


I'v found a solution. It appears that ttygif allows You to use a starting command with flag -e So it's enough to do

ttyrec file_name -e "tmux a"

Or in my case

record-session -e "tmux a -t my_session"
  • This is what @Fiximan wrote before in the comment. Apr 22, 2019 at 17:14

You must log in to answer this question.

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