It is not really possible to save a complete screen session.
What you can do is to create a proper
.screenrc which will setup some things after you restarted your system.
Here are some comments to the things you listed:
- The number of opened shells
- The name of each shell
- The current directory of each shell
I use something like this in my
.screenrc to open some specific shells on startup:
## set the default shell
screen -t 'zsh'
screen -t 'mutt' mutt
screen -t 'zsh' /home/user/bin/scriptToRun
You will get the string between '' as your window name and the command after the name will be executed on your default shell. Include any script you want, for example change in a specific directory and open some logs.
- The history of each shell
Have you ever thought about sharing the history of the shells across your sessions? IMHO this makes things much more easier. In ZSH its done with
setopt SHARE_HISTORY in your
- If possible, their environment variables
If you really need this and don't want any trade-off you could think about a shell script, which reads out the current state of screen, saves the number of shells, environment variables, etc. and puts this information in a startup script called by your
For me this would not be worth the effort because I appreciate a clean environment after a reboot, if I can customize the default windows for screen.