Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7837639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:45:49+00:00 2026-06-02T14:45:49+00:00

I’d like to be able in tmux to load sessions saved in a file

  • 0

I’d like to be able in tmux to load sessions saved in a file including window/pane and shell setups. I have this in ~/.tmux/my_session:

new -d -s test1
neww -k -t test1:1 top

new -d -s test2
neww -k -t test2:1 -n '2w1' 
neww -t test2 -n '2w2' 

Now I source it in tmux and this works fine: I have two detached sessions test1 (with one window) and test2 with 2 windows. But I’d like to actually run also some commands, e.g. replace the last line with:

neww -t test2 -n '2w2' 'cd ~/work; ./myscript.zsh ; ls'

So that it cds to the directory, runs some setup scrip, does ls and stays open for further use. According to the manual however windows close automatically after command finishes. There is an option remain-on-exit but it’s not clear how could I combine it it with neww so that it actually works…

Also the manual list a -c flag for neww to set starting dir, but my homebrew installed tmux v1.6 doesn’t seem to recognize it.

teamocil seems to be able to do it so it has to be possible (but teamocil doesn’t keep the sessions separate which is essential for me).

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:45:54+00:00Added an answer on June 2, 2026 at 2:45 pm

    The answer is send-keys:

    new -d -s test1
    neww -k -t test1:1 -n '1w1'
    send-keys -t test1:1 "echo '1w1'" C-m
    
    new -d -s test2
    neww -k -t test2:1 -n '2w1'
    neww -t test2 -n '2w2'
    send-keys -t test2:1 "echo '2w1'" C-m
    send-keys -t test2:2 "echo '2w2'" C-m
    
    display-message "Sessions loaded!"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.