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 8968599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:28:36+00:00 2026-06-15T17:28:36+00:00

I want to open a new tmux session and window with cmus in it

  • 0

I want to open a new tmux session and window with cmus in it or, if alredy running, attach to it. At Ubuntuusers I found this Script that should do it.

1. #!/bin/bash
2. SESSION=main
3. tmux="tmux -2 -f tmux.conf"
4. 
5. # if the session is already running, just attach to it.
5. $tmux has-session -t $SESSION
7. if [ $? -eq 0 ]; then
8.   echo "Session $SESSION already exists. Attaching."
9.   sleep 1
10.  $tmux attach -t $SESSION
11.  exit 0;
12.  fi

I alredy know that i can do manually it with

tmux new -n music cmus

But when I use it in the script I only get the Message

usage: new-session [-d] [-n window-name] [-s session-name] [-t target-session] [-x width] [-y height] [command]

I also tried it with new-session, but no change. I have absolutly no clue whats the problem with the command or the script or both

  • 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-15T17:28:37+00:00Added an answer on June 15, 2026 at 5:28 pm

    The way I solved this is to have a main tmux session, that programs like mutt or cmus can either start or connect to. For example, for cmus I have an alias:

    alias cmus='monkeys -n music cmus'
    

    With monkeys being the following script:

    #! /bin/sh
    
    name=monkeys
    
    # make sure tmux server is running:
    tmux start-server
    
    # determine if monkeys session is running:
    tmux has-session -t ${name}
    
    # no monkeys running, create monkeys,
    # if more than one argument, take it as a command to run 
    # on monkeys, else just attach to monkeys
    if [ "$?" != "0" ]; then
        tmux new-session -s ${name} $*
    elif [ $# -gt 0 ]; then
        tmux new-window -t ${name} $*
    else
        tmux a -t ${name}
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my javascript i want to open URL in new window with this method:
I want to use a script to open a tmux session with 6 windows,
I want to open a new window with a textfield that copies what you
I'm new to VSDO, and i want to open new template/word popup window within
I have a button: <button>Click</button> I want click it and open a new window
I want to open new url as a popup window on form submission. Can
I want to open a new window and carry over some of the HTML
I want to open a new browser window with a specific url (say http://google.com
I am creating a Kinect application and want to open a new window called
I have a javascript function in which I want to open a new window

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.