The terminal show ttys and keep a long time - terminal

When I open the terminal on MaxOS, ttys001 show as above. I have tried to search what's the meaning of ttys and result as below.
The ttys001 part is just the terminal window session number
But my problem is this screen keep a long time. How can I short the time?

Related

TMux Scrollback Becomes Static

I have a kinda weird question. Sometimes in some of my long-lived tmux sessions I'll have a window where the history will get kinda "stuck"
So, to clarify, that's a (bash) shell, inside a pane, inside tmux, and that shell has been running for a while.
I have my scrollback set high and I use it all the time, so I know how to use it and how it works in tmux. But sometimes something will happen and I'll always get the same history when I scroll back no matter what I print.
So for example, I'll run something like seq 1 100 and I'll only see the numbers 76 to 100 in the pane, but when I scroll up I don't see 75, I'll see the result of some git command I ran a while back. No matter what I run, when I scroll up it's that same output of that same git command, or whatever happens to have been up there when it broke.
I can exit the shell and re-open it, that works, but I'd rather not. I'm wondering if there's some kind of term control character or something, or broken curses code, or something that maybe didn't clean up properly in my terminal that would have left me in this in-between state where new lines are shown, but not added to the history? Any idea? I tried running reset, but it doesn't seem to have fixed it.
Does this make sense to anybody? I'd love to learn something new about how shells communicate with terminal emulators that makes this make sense.
Thanks!

How can I reset my terminal in a GNU screen session after accidentally printing binary garbage?

Sometimes I accidentally print binary garbage on the screen, for example I have printed a binary hash value or nonce instead of the hex hash value.
Sometimes the terminal is messed up in various ways after this, because the binary data contained escape sequences which reconfigure the terminal, rendering it almost useless.
When in a normal shell (locally or via ssh) it is usually sufficient to blindly type reset and press enter. (Often the typing is not visible due to the messed up terminal configuration.)
But when in a shell which is inside a GNU screen session this is sometimes not sufficient and the shell is still unresponsive.
How can I revive my terminal without destroying it and re-creating it?
The GNU screen terminals maintain part of the terminal state, too. To reset that in GNU screen do:
Press Ctrl-A.
Enter :reset and press enter.
Done. You may also need to enter reset in the terminal itself as well as usual.

terminal command is overwritten on itself

sometimes in terminal when I type a long command, instead of continuing in the next line it starts to write at the same line and I cannot see what I am typing. What is the reason and how should I make it fine?
Sometimes if you resize a terminal window while in a fullscreen command (say inside "vim" or "less"), when you exit back to the shell it will assume your terminal has the old dimensions, and will show the behavior you are describing. See this question: https://unix.stackexchange.com/questions/61584/how-to-solve-the-issue-that-a-terminal-screen-is-messed-up-usually-after-a-res
Also, please in the future post this kind of questions in unix.stackexchange.com as this one is not strictly a programming question.

Change the previous output in a terminal when a resize occurs

How can I execute a previous command in the terminal when a resize of terminal occurs
For example, when I execute the command ls in terminal what I get is
when I do a resize what I get is
Output of ls in a short window
but when I resize the window to large the previous output of the command does not change and what it looks like is The preview of previous output when I resize window
but I want the terminal to be refreshed itself on resize of the window.
My desired Output
In short, I want a bash script to execute every previous command before or a selected command as a web-browser does.
I had seen the question already before when I asked this question but that question won't provide me a solution because I want my previous command to be executed but not any functions or any other after commands

How to keep same line on terminal top with long output?

Under Ubuntu 14.04, I'm writing a script that output a lot of text (several commands...), and I would like to keep one or more lines always on top of the terminal screen to display what's running title.
In other words, I try to reduce terminal vertical scroll zone and write in that non-scrolling zone.
How can I do that? I saw similar stuff using a loop catching output line by line, but I'm unable to find a way to tell the system to print from let's say line 2 or 3.
Thanks for your answers,
Nicolas
Nic, it appears this does quite nicely.
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html

Resources