this works attach session specified name or create if doesn't exist:
tmux new-session -a -s encode
but need add command run ie.
tmux new-session -a -s encode 'ls /home/user/'
you'll want take @ tmux send-keys
command. man
send key or keys window. each argument key name of key (such
c-a
ornpage
) send; if string not recognised key, sent series of characters. -l flag disables key name lookup , sends keys liter- ally. arguments sent sequentially first last. -r flag causes terminal state reset.
in case can do
tmux new-session -d -a -s encode tmux send-keys -t encode 'ls /home/users' c-m tmux attach -t encode
c-m
enter key. -d
flag create session, not attach it.
Comments
Post a Comment