2

I have created a keyboard shortcut that initiates an SSH session to my server which works as expected and there is no issue with that.

However, to enable faster access to multiple log files I have resorted to opening multiple terminals with the same command, this means several terminals each with its own ssh session.

What would like to happen is to have just one terminal/ssh session and open each log file under a separate tab.

How would you approach this?

The current keyboard shortcut I use is: (previously -x updated --):

gnome-terminal -- ssh server1r

Note: server1r is a just a predefined ssh configuration in ~/.ssh/config

Previously: running this in the terminal creates a new tab showing the error log:

 gnome-terminal --tab-with-profile=basic -- ssh server1r "tail /var/log/apache2/error.log -f"

Previously: This is where I am at now using information gleaned from various sources including man gnome-terminal, :

gnome-terminal --tab-with-profile=basic -- ssh server1r "tail ~/logs/error.log -f -n500" && gnome-terminal --tab-with-profile=basic -- ssh server1r "tail ~/logs/access.log -f -n500"

The above code runs perfectly from the terminal, creating two new tabs with the log entries shown. However, putting the command into the keyboard shortcuts doesn't work as expected. only the first log is opened and no tabs are created.

Keyboard shortcut entered exactly as above in: settings > devices > keyboard > custom shortcuts

Final Update: I have created a bash script using last code block as a temporary workaround giving me a terminal for each log. From this point I will check in periodically so see if anybody answers with a better solution, but at least for now I can open all of the required logs from one keyboard shortcut.

1 Answer 1

2

Change your shortcut to something like this:

gnome-terminal --tab -- "ssh user@server1r" --tab -- "ssh user@server1r"

Continue adding tab's for however many you need.

If you want to run a command directly on the server you ssh to add your tail command or whatever you use after the SSH command fx:

ssh user@server1r tail /var/log/messages -f

This would SSH to the box and start tailing /var/log/messages.

It will however end the ssh session if you stop it.

So the shortcut would end up something like this:

gnome-terminal --tab -- "ssh user@server1r tail /var/log/messages -f" --tab -- "ssh user@server1r tail /var/log/secure -f"

This of course requires SSH key configured, which it seems you already have.

If you want to be sure its a new window (in case you already have some terminal running)

Add this adjusting the geometry to whatever you want:

--geometry=80x16+0+0 --window
1
  • deleted last comment i found the cause, ubuntu 18.04: --tab doesnt seem to work but --tab-with-profile does. with the move into the next step ive updated my question because I cant get it to work with more than one tab. Aug 14, 2019 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .