Specifying the Telnet window size - linux

I'm trying to use say a command on a remote system that I'm connected to. A command like "top" where it it uses the full screen to display output, but telnet seems to have a default window size. Does anybody know how to change it?
Thanks in advance.

After you've telneted to the system you can set the terminal size with
stty rows 25 columns 80
No, telnet is likely not smart enough to somehow transfer these values to the destination system.

It seems I found out myself how to do it...
I needed to set the evioronment variables LINES and COLUMNS on the system that I was telneted too, it didn't really have anything to do with telnet itself. I did it in the following way:
I first ran "resize" to get the amount of lines and columns my current terminal was it gave me the following:
COLUMNS=157
LINES=53
export COLUMNS LINES
I then pasted this in to the system I was telneted to.
TADA! :)

Have you tried the debugging steps outlined here?

Related

Teraterm Sendln issue, it cannot send the full command

I need help when debugging teraterm script. The simple codes shown below:
connect "/c=20 /baud=115200"
pause(8)
cmd = 'r 10314 1'
sendln cmd
pause(3)
closet
Actually only send command of "r 10314 1". What I saw that this command is issued successfully, but in Teraterm window, only the command shows: r 1 . Why sendln doesn't send all the commands? Appreciate.
Have you checked that both devices can handle that fast of a baud rate? Instead of 115200, have you tried a slower speed?
The code looks good (as in you are only sending one string with the same apostrophe on both sides, this can also be achieved with two double quotes) and waiting 3 seconds after, there should be no problem; I would try with lower baud rates to see if you aren't trying to send the data faster than capable.
Here's some things to look at that can maybe help:
https://ttssh2.osdn.jp/manual/en/macro/syntax/formats.html
https://learn.sparkfun.com/tutorials/serial-communication/all

ZOC Terminal:text has been cut halfway down the page

I work with ZOC terminal installed at windows 7 in order to communicate with device that has Linux operating system zoc picture.
The communication via terminal works great but recently the text has been cut halfway down the page.
attached picture .
The picture shows 24 lines. You can get this behavior if your terminal description sets scrolling margins to 24 lines — as some might do, when initializing the terminal if the application assumes that the screen has 24 lines.
Since ZOC could be connecting via a serial port, that may not allow negotiations about window size (NAWS). You might then see that stty -a shows 24 lines in its output. ZOC is said to emulate a VT100; you can usually adjust its notion of screensize either directory (using stty) or using the resize program (which calls the same system functions as stty as a side-effect).
Alt+y solved the issue I had..

Access output in Ubuntu 14.04 terminal that has 'disappeared' off the terminal window

I just ran a script on a server that generates a lot of output on the command window.
However, now, after running it for roughly 4 hours I want to check all the output, but the beginning of the output has already disappeared from the terminal window. When I scroll up, it is not there anymore.
Is there any way to access this? It needs to be via commands in the terminal because I'm running it on a server.
Thanks.
Best way is to redirect the output to a file & open the file to check for all the output.
You can also redirect the script by running it in background & saving the output to a file. Do let me know what type of command you are running for which I can give you the exact command. :)
if it's a real terminal and not a virtual terminal
you need to recompile your kernel and increase the buffer size of your terminal.
in the .config file of your kernel the parameter you need to increase is
CONFIG_VGACON_SOFT_SCROLLBACK_SIZE
Actually, redirecting I/O interferes with many programs (for instance, changing the output from a tty to a plain file). Use the script program to capture all output from programs run in a shell, with minimal interference.

Easy way to colour ALL user input in terminal?

I know that there is lots of info for colouring the output of certain commands, but I want to have a specific colour for everything I write into the Mac terminal.
It would allow me to have a special colour for everything I input - not the output, just the code I personally input - making it easy to scan the code to where the last command was. I want to find a way to do it without having to write a colour alias for every single command - A way that by default will implement a unique colour for everything I write in the terminal.
Thanks for your help.
I have now sorted this...
Open your ~/.bash_profile in whatever editor you prefer.
Add the following code:
export PS1="\e[0;32m[\u#\h \W]\$ \e[m"
and save.
You will now see that your command prompt is coloured green, and it's super easy to find yourself in the terminal :)
Hope that's helpful for anyone trying to fix the same problem!
P.S> These instructions cover more than just the colour in the terminal... They also control what it shown in your command prompt. I'm afraid that it will need someone way more advanced at coding than me to decipher which bit refers to what... Sorry!

Linux(Ubuntu) Terminal-how to view previous pages not visible anymore

When you scroll up, say to see a log, the first portion of it will not be visible since the terminal only supports a limited no. of lines. So if you want to scroll up and be able to see everything, at least a few pages up, how do you do it?
Use Shift+Page Up and Shift+Page Down.
Piping the output to a pager like the following is a better choice:
command | less
command | more
You can enable unlimited scroll back (or a huge amount if you want).
To do this, go to
File → Profile preferences → Scrolling [tab]
Then, check Unlimited, or set the number of lines desired. And of course, it only applies to the next typed lines.
Some tricks I use-
some terminal applications (gnome-terminal) allow you to increase the scroll-back buffer size
pipe output to a file:
command > file.log
pipe your command to less:
command | less
tail log and pipe to grep to reduce output
tail -f example.log | grep 'search text'
An alternative to screen is using tee to copy all output to a file while still printing it on the terminal:
yourcommand | tee output.txt
Try using the screen command, and set its scrollback buffer to a larger size.
screen has many other benefits and wonderful features.
If all you're doing is looking at a log, you could alternately use a pager such as less
If you want to scroll line by line, you can use
Control+Shift+Up/Down Arrows.
If you are using gnome-term (the default), then you can change your settings. Either set the no. of lines to unlimited, or to a much larger buffer size than the default.
Essentially seconding to #zerick's solution but if you're on gnome-terminal you can modify its config. See this.
If you are in tmux (can create multiple terminal sessions in a single terminal session, highly recommended), you can easily use your normal navigation keys to scroll around after you do Ctrl-b then [, for more details let's take a look at: How do I scroll in tmux?
None of these answer the original question. All answers are how to make new terminal windows (or current one) start behaving a certain way. The question is about how to see whats already scrolled away.
To answer this, each terminal session should have it's own "history" file (not to be confused with what command history is) containing all the stuff that relates to stdin/stdout displayed. I could be wrong but this may be different depending on the terminal emulator you use. Some just trash it when you close the window/ end the session.
I am trying to get this figured out myself so here is the more direct answer in a different thread.
https://unix.stackexchange.com/questions/145050/what-exactly-is-scrollback-and-scrollback-buffer
From what this tells me, I suspect best advice you can get is, for whatever terminal emulator you use, look for where it stores the scrollback buffer and that might be your only hope. It's what I am going to try right now. (and that is IF the session is currently still open, not closed terminal windows)

Resources