Open several ssh terminals at once: Difference between revisions

From Sea of Fate
Jump to navigationJump to search
Created page with "==Introduction== Continuing the theme of '''Random stuff''' and more particularly of '''Code Snippets'''"
 
No edit summary
Line 1: Line 1:
==Introduction==
==Introduction==
Continuing the theme of '''[[Random stuff]]''' and more particularly of '''[[Code Snippets]]'''
Continuing the theme of '''[[Random stuff]]''' and more particularly of '''[[Code Snippets]]''' and '''[[Linux Bash & Shell]]'''. This is how to open several terminals at once.
 
==The First version==
 
Open a text file with the ext of .sh
nano ./open_prod_terminals.sh
Copy the following into the file.
#!/bin/bash
 
# Open SSH sessions in separate terminal windows
gnome-terminal --tab --title="logan" -- bash -c "ssh logan; exec bash"
gnome-terminal --tab --title="fig" -- bash -c "ssh fig; exec bash"
gnome-terminal --tab --title="mandarin" -- bash -c "ssh mandarin; exec bash"
 
exit 0

Revision as of 18:42, 28 February 2025

Introduction

Continuing the theme of Random stuff and more particularly of Code Snippets and Linux Bash & Shell. This is how to open several terminals at once.

The First version

Open a text file with the ext of .sh

nano ./open_prod_terminals.sh

Copy the following into the file.

#!/bin/bash
# Open SSH sessions in separate terminal windows
gnome-terminal --tab --title="logan" -- bash -c "ssh logan; exec bash"
gnome-terminal --tab --title="fig" -- bash -c "ssh fig; exec bash"
gnome-terminal --tab --title="mandarin" -- bash -c "ssh mandarin; exec bash"
exit 0