It's pretty easy with tmux (via "tmux send-keys") but you need to consider unwanted side-effects if the session isn't at a shell prompt awaiting input. What happens if, say, a command like vim is the foreground task when you try to execute that command? You're just asking for trouble trying to do it that way. The only time I use that capability is when I know I'm establishing a new session and want to do some custom initialization (e.g., cd'ing to a particular directory and launching my editor). On Thu, Feb 6, 2014 at 10:27 AM, Thorsten Kampe wrote: > Hi, > > tough question: can I automatically execute a command on reattaching > a detached byobu (screen or tmux) session? > > Every time I login, /etc/motd is displayed. Since I hardly ever log > out and in, I'd like to have the same functionality when reattaching > to my detached session. This could be a simple cat /etc/motd kind of > "autostart". > > Thorsten > > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank