screen Command in Linux
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
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.
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
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
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
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.




