How To Save and Restore Last Open Tab Of Ubuntu Terminal
Posted By : Md Imroz Alam | 27-Feb-2018
Whenever we work on any project. We have to open multiple tabs with specific microservice.
When we shutdown system. Again, we have to open those tab manually.
If we want to save those opened tab location. Yes, it is possible.
Step 1.
Install terminator using the following command
sudo apt-get update
sudo apt-get install terminator
Step 2.
open terminator with multiple tabs
i) Right click on any tab.
ii) Go to preferences
iii) click on a layout tab
iv) click on add button. You will see all tab within this layout
v) Set name of a layout as "my layout" whatever you want
vi) On double clicking on "New Layout" text and the set name of your layout
vii) Click on a Terminal text which is under the window menu. set the working directory for each tab as "/home/ubuntu/Documents/".
Note:- We can also set profile for your each tab. Suppose any tab you want different foreground or background colour, font-size.
To create a profile , go to profile tab and click on add button and set configuration as per our need.
We can also set the title of all tab respectively for saving tab
viii) Go to ~/.config/terminator and open config file.
Following are the config file detail-
[global_config]
title_font = Monospace 11
title_receive_fg_color = "#c25e5e"
title_transmit_bg_color = "#00c82b"
title_transmit_fg_color = "#c65e5e"
window_state = maximise
[keybindings]
[layouts]
[[default]] //Layout name
[[[child1]]]
directory = /home/ubuntu/Documents/Project
parent = window0
type = Terminal
[[[window0]]]
parent = ""
type = Window
[[New Layout]]// Layout Name
[[[child0]]]
fullscreen = False
last_active_window = True
maximised = True
order = 0
parent = ""
position = 65:24
size = 1301, 744
title = ~/Documents
type = Window
[[[child1]]]
active_page = 2
labels = microservice1, user-panel, Core, nginx, mysql, jmeter, backend // title of opened tab
last_active_term = 2d37dffa-7a82-454c-802f-4d7c1b7f699a, 2e1e1d4f-e0fa-4cc4-b235-b9c33d203dcc, 18cec2bb-8044-48d3-a5c1-49896afcea79, 8cedae22-b889-4c85-8dda-6a4cb2ae4ea9, af42aff9-9caf-4746-9371-dfdbaeb148a3, 480b6181-836b-4067-b092-b3d4247d0442, 6ed64940-4990-4140-a46d-8bbe76a6f1a1
order = 0
parent = child0
type = Notebook
[[[terminal2]]]
order = 0
parent = child1
profile = Frontend
type = Terminal
uuid = 2d37dffa-7a82-454c-802f-4d7c1b7f699a
[[[terminal3]]]
order = 1
parent = child1
profile = default
type = Terminal
uuid = 2e1e1d4f-e0fa-4cc4-b235-b9c33d203dcc
[[[terminal4]]]
order = 2
parent = child1
profile = default
type = Terminal
uuid = 18cec2bb-8044-48d3-a5c1-49896afcea79
[[[terminal5]]]
order = 3
parent = child1
profile = default
type = Terminal
uuid = 8cedae22-b889-4c85-8dda-6a4cb2ae4ea9
[[[terminal6]]]
order = 4
parent = child1
profile = default
type = Terminal
uuid = af42aff9-9caf-4746-9371-dfdbaeb148a3
[[[terminal7]]]
directory = ""
order = 5
parent = child1
profile = default
type = Terminal
uuid = 480b6181-836b-4067-b092-b3d4247d0442
[[[terminal8]]]
directory = ""
order = 6
parent = child1
profile = default
type = Terminal
uuid = 6ed64940-4990-4140-a46d-8bbe76a6f1a1
[[mylayout]]
[[[child0]]]
fullscreen = False
last_active_window = True
maximised = False
order = 0
parent = ""
position = 149:413
size = 642, 378
title = ~/Documents
type = Window
[[[child1]]]
active_page = 1
labels = Belfrics, Frontend
last_active_term = 2d37dffa-7a82-454c-802f-4d7c1b7f699a, 2e1e1d4f-e0fa-4cc4-b235-b9c33d203dcc
order = 0
parent = child0
type = Notebook
[[[terminal2]]]
command = ""
directory = /home/ubunte/Documents/Project
order = 0
parent = child1
profile = Frontend
type = Terminal
uuid = 2d37dffa-7a82-454c-802f-4d7c1b7f699a
[[[terminal3]]]
command = ""
directory = /home/ubuntu/Documents/Project/microservice1
order = 1
parent = child1
profile = default
type = Terminal
uuid = 2e1e1d4f-e0fa-4cc4-b235-b9c33d203dcc
[plugins]
[profiles]
[[default]]
background_image = None
font = Monospace 11
scrollback_infinite = True
use_theme_colors = True
[[Frontend]]
background_image = None
scrollback_infinite = True
Step 3.
To open specific layout
i) Type following command on terminal
terminator --layout="YourLayoutName"
ii) To set the title of a terminal in ubuntu 16.04
add the following line of code into .bashsrc at end of a line
set-title(){
ORIG=$PS1
TITLE="\e]2;$@\a"
PS1=${ORIG}${TITLE}
}
Save to set title of terminal
Type following command on terminal
set-title "Your-Title"
Thanks
I hope this will be helpful.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Md Imroz Alam
Md. Imroz Alam is a bright Web App Developer, he has good knowledge of Java, J2SE, Jsp, Servlet, jdbc. His hobbies are watching movie, playing carom.