Linux – How to remember multiple tabs’ session in terminal in ubuntu

ctagslinux terminalvim

I have opened many files in vim and there I am editing and tracing the program flow using ctags and I don't want to lose all those info in next reboot, I can't keep my system on for few weeks or months.

Is there any way to save current terminal state or/and vim stack state?

Here is similar question

Best Answer

Read :help :mksession.

:mksession /path/to/sessionfile

This command writes a script that you can run later with

:source /path/to/sessionfile

You can run these commands automatically when you leave and launch Vim with an autocmd. Read this page on the Vim wiki for ideas.

Saving a terminal session is a different problem. Both tmux and screen allow you to deattach/reattach sessions but I admit I don't know if they can survive a reboot.


This answer explains how to script your tmux session and restore it later. Something along that line could probably be done for screen.

If you don't use tmux or screen, you are left with the capabilities of your terminal emulator.