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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:54:46+00:00 2026-06-05T21:54:46+00:00

screen -R -D -S test will create a session named test if it doesn’t

  • 0

“screen -R -D -S test” will create a session named test if it doesn’t exist, or connect to it if it does

“screen -d -m -S test” will create a new detached session named test, whether it exists or not, possibly leading to multiple sessions named test:

There are several suitable screens on:
    9705.test   (06/18/2012 06:42:58 PM)    (Detached)
    9639.test   (06/18/2012 06:42:57 PM)    (Detached)

How can I create a detached session named test, but only if one doesn’t already exist?

  • 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-05T21:54:48+00:00Added an answer on June 5, 2026 at 9:54 pm

    I believe you’re looking for the -d -R combination:

    screen -d -R -S test
    

    From man screen:

          -d -R   Reattach a session and if necessary detach or  even  create  it
                  first
    

    EDIT

    If you just want to create a background screen only if it doesn’t exist, a little shell function in your ~/.bashrc or ~/.zshrc will work:

    function bgsc { 
      if screen -list | awk '{print $1}' | grep -q "$1$"; then
        echo "screen $1 already exists" > &2
      else
        screen -d -m -S $1
      fi
    }
    

    Then just call bgsc test.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

QTP which access an application object in test PC screen resolution doesnt access the
I'm trying to test using SFML's full screen mode, however it crashes every time
I am testing an application and need to test it with different screen resolutions
I recently posted a question about screen rotation in my live wallpaper. To test
I am trying to create a simple batch file that will replace a line
I'm trying to draw shapes that will move around the screen using the LunarLander
My Question: Does a HttpWebResponse.StatusCode detect Asp.Net errors? Mainly a yellow screen of death?
Consider the following scenario: a FIFO named test is created. In one terminal window
I have a simple test app i am working on. This will be later
I'm trying to test my application on different screen sizes and densities. To do

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.