screen Command in Linux

Learn via video courses
Topics Covered

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

Overview

The screen command in Linux is a powerful tool that allows users to manage multiple terminal sessions within a single terminal window. It is particularly useful for running long processes, remote administration, and multitasking without using multiple terminal windows.

Linux screen Command Syntax

The syntax for the screen command is as follows:

Where:

  • options: These are the flags or parameters that modify the behavior of the screen command.
  • command: The command or program to be executed within a new screen session.

screen Command Options:

  • -S: Creates a new session with a specified name.
  • -ls: Lists all the active screen sessions.
  • -r: Reattaches to an existing screen session.
  • -X: Sends a command to a running screen session.
Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course

Example Usages

  • Create a new screen session:

    Output:

    Explanation: The command creates a new screen session without any specified options.

  • List all active screen sessions:

    Output:

    Explanation: The command lists all the active screen sessions with their respective session IDs.

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Tips

  • To detach from a screen session without closing it, press 'Ctrl + A' followed by 'D'.

  • To switch between screen sessions, press 'Ctrl + A' followed by 'N' for the next session or 'P' for the previous session.

Advanced Use Cases of screen Command in Linux

  • Create a new named screen session:

    Output:

    Explanation: The command creates a new screen session with the name 'example'.

  • Reattach to an existing screen session:

    Output:

    Explanation: The command reattaches to the screen session with the name 'example'.

  • Send a command to a running screen session:

    Output:

    Explanation: The command sends the 'ls' command to the running screen session named 'example'.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Conclusion

  • The screen command is a powerful tool for managing multiple terminal sessions within a single terminal window.

  • Screen sessions can be named, listed, and reattached to as needed.

  • Commands can be sent directly to running screen sessions.