Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
Can I attach screen after system restart?

I used to create a screen and use vim to trace source code. I usually use the commands to create, detach and attach a screen to keep my vim status. $ screen -S vim_src1 [CTRL+a] d to detach the screen $ screen -r vim_src1 However, screen status will be killed after system restart. Can I attach screen after system restart?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

After a system restart there is no screen session to attach. You can certainly create a new session.

A screen session that you could attach has been running since you detached it. A system restart kills all of the processes (including those running in screen).

In desktop environments, you may see occasional support for saving "session" state. Doing that relies upon each application to save its state when asked, e.g., on system shutdown. That can be workable for large GUI applications (which are designed to handle events). But in contrast, screen is mostly used for shell applications where this is done rarely.

Rather than require each application to save/restore itself, it is conceivable that the operating system could be designed to do this. But that does not appear to be the case for the systems we are using.

Further reading:

  • How to Automatically Remember Running Applications from Your Last Session in Ubuntu 14.04
  • How can I keep restore for apps in Lion without having session restore when I log in?
over 4 years ago · Santiago Trujillo Report

0

I can interpret your answer in a few ways, because I'm not 100% certain what your objective is. I'll try to give the two most obvious options I'm aware of.

You can configure your screen session with ~/.screenrc so it always launches the same with, with labels and for screens, and it will even launch applications for you. For example:

defutf8 on
caption always "%{= kK} %{K}%-w%{+b w}%51>%n %t%{= K}%+w%<%-=%{= kK} me@localhost | %{w}20%y-%m-%d %{w}%0c:%s %{-}"
shelltitle '$|$'
defscrollback 10000
termcap xterm|xterms|xs ti=\E7\E[?47l
terminfo xterm|xterms|xs ti=\E7\E[?47l
startup_message off
screen -t vim       0  vim $HOME/todo.txt 
screen -t ipython   1  ipython
screen -t finch     2  finch
screen -t mutt      3  mutt
screen -t top       4  top

chdir $HOME/Repos/git
screen -t CL        5   
screen -t git       6

If you actually want to be able to save a session that you're in you might consider using screen-session.

https://github.com/skoneka/screen-session

Session saver currently supports saving of: layouts, scrollbacks, titles, filters and is able to restart programs run in windows. It recognizes regular, group and zombie windows. Currently there is no support for serial and telnet window types. By default, session saver also tries to save Vim sessions using ":mksession" and ":wviminfo".

Session saver accesses important data by directly reading /proc filesystem and sorts processes by parent pid. There is almost no "stuffing" of commands into windows (except when saving Vim sessions) so there is no interaction with programs itself.

During session loading, every new window starts with screen-session-primer (a small C program) which displays a list of processes and asks user what to do: whether to start none, some or all of window's processes or directly starts programs provided "--force-start [win_num]" option was used.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!