How do I increase SSH window buffer length?

1,714 views
Skip to first unread message

Aaron Markstaller

unread,
Apr 26, 2021, 9:25:21 AM4/26/21
to gce-discussion
Hey all,

I open an SSH connection to one of my VM instances (is this a cloud shell? is it different from a cloud shell?) and start one of the python scripts that I have downloaded to it and it prints out some information I need from it and then it starts cutting off the old stuff when it gets to a certain number of lines.  
Is there a way to increase the buffer length for inputs and outputs in an SSH connection window?  

Thanks

Anthony Leo

unread,
Apr 26, 2021, 3:03:14 PM4/26/21
to gce-discussion
It seems that there is no way to increase the SSH terminal buffer size in GCP. However, you can use "Third party tool" Putty and increase the buffer size

Aaron Markstaller

unread,
Apr 27, 2021, 10:09:08 AM4/27/21
to gce-discussion
Thanks that's perfect.  Seems weird that Google 's built in wouldn't have such a simple option

Ted

unread,
Apr 27, 2021, 11:17:44 AM4/27/21
to gce-discussion
You didn't specify that OS you were using, but note that gcloud CLI doesn't actually include an ssh client.  It just uses the system-provided ssh client, and it provides a front-end interface to that ssh client.  So for example, on a linux system, you can use the --dry-run option to see that "gcloud compute ssh xfstests-ltm" actually runs the command:

% gcloud compute ssh --dry-run xfstests-ltm
/bin/ssh -t -i /home/tytso/.ssh/2021/gce-2021 -o CheckHostIP=no -o HostKeyAlias=compute.3698096746542602258 -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/home/tytso/.ssh/google_compute_known_hosts ty...@35.185.71.47

Similarly, in terms of the scrollback window (which is what I think you are talking about), that's controlled by whatever terminal window that you are using.  On a Linux GNOME or KDE terminal, you can adjust the scrollback window size, via a settings page.  For example, for KDE's terminal (Konsole), you go to the menu bar, select "Settings", then "Edit Current Profile", then select "Scrolling", and you can configure the scrollback size some number of lines, or "Unlimited", with the warning: "the scrollback data will be saved to RAM.  If you select a large value, your system may run out of free RAM and cause serious issues with your system".    

The above reply seems to assume that you are using a Windows system, and it appears that the Windows-provided "cmd" terminal window may not provide a way to adjust the scrollback size.   But the "putty" client, which opens its own window, does, and that's what the linked instructions are referencing.

You seem to have expressed some confusion about what a "cloud shell" might be.   So there is a feature in the GCE Console (the web page interface), which allows you to open a Browser window that acts like a terminal, and it starts a very tiny VM in your current GCE project.  From that tiny VM, you can ssh into VM's in your project.   This is super-handy if you need to access a VM in a hurry, but it's a very limited environment.    In particular, since the "cloud shell" window is really a Browser popup window, commands to close  a browser window will affect the "cloud shell" window.   It doesn't have a scrollback feature at all.   I view it as an emergency measure, when I don't have access to my standard Linux development laptop; since if I do, I'll generally issue the "gcloud compute ssh" command from my KDE terminal window, which is a much more fully-featured alternative.

Cheers,

-- Ted

Shamma Nikhat

unread,
Apr 27, 2021, 12:05:35 PM4/27/21
to gce-discussion
Just to add , the SSH terminal is not the same as Cloud Shell terminal. 
Reply all
Reply to author
Forward
0 new messages