terminal input buffer size

Hi all.

When in terminal I run the command that reads user input from stdin, for example base64 , I can paste or type up to 1024 characters (bytes). After that terminal starts beeping and does not allow me to type or paste anymore input. Where is the terminal input buffer set and how can I increase it?

Thank you

Answered by DTS Engineer in 801255022

I mean where is the terminal input buffer size set and how can I increase it?

I don't think Terminal.app itself has any such limitation. Here's what I did to verify this:

  • Opened up BBedit and copied/pasted to create an arbitrarily large file. The test I ended up with was ~35,000 lines of scheme code (I happened to have a sandbox profile).

  • Select All and copy.

  • Open Terminal.app and run "pico".

  • Paste and watch Terminal.app flow all content into pico.

As a bonus round:

  • Use BBedit to remove all "\n" characters, creating a single text line of truly ridiculous length.

  • Paste that string into pico

As I write this, Terminal.app is stil feeding that string into pico and has been for 40+s. As far as I can tell, everything is working fine and it's happily continuing to feed the text in even after I've switched back to a different app. I fully expected "something" to break, but nothing has so far.

In any case, the key point here is that Terminal.app itself it perfectly happy to send virtually unlimited text into a "target" that can handle it. I only used "pico" out of my own preference, all that really mattered was that the receiving target was "expecting" long input (like a text editor).

Returning to here:

When in terminal I run the command that reads user input from stdin, for example base64 , I can paste or type up to 1024 characters (bytes).

This limitation comes from how the shell and the underlying tty manage their I/O, not terminal.app. What you do about it... depends on what you're actually trying to do. This general issue is called "Line discipline", which is typically divided into "canonical" (line oriented and how the shell works) and "raw"/"non-canonical" (input is directly processed, which is how interactive apps like pico work). There are a variety of tweaks you can make to the terminal that will change how this behaves but I haven't actually played with them very much and they all have complicated tradeoffs. All of this is also well outside of the macOS architecture and is really common to all Unix system.

BTW, Terminal.app is still busy pasting my single line of text, even several minutes later. I'm not convinced it will work, but I can't bring myself to kill it yet.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

I mean where is the terminal input buffer size set and how can I increase it?

I mean where is the terminal input buffer size set and how can I increase it?

I don't think Terminal.app itself has any such limitation. Here's what I did to verify this:

  • Opened up BBedit and copied/pasted to create an arbitrarily large file. The test I ended up with was ~35,000 lines of scheme code (I happened to have a sandbox profile).

  • Select All and copy.

  • Open Terminal.app and run "pico".

  • Paste and watch Terminal.app flow all content into pico.

As a bonus round:

  • Use BBedit to remove all "\n" characters, creating a single text line of truly ridiculous length.

  • Paste that string into pico

As I write this, Terminal.app is stil feeding that string into pico and has been for 40+s. As far as I can tell, everything is working fine and it's happily continuing to feed the text in even after I've switched back to a different app. I fully expected "something" to break, but nothing has so far.

In any case, the key point here is that Terminal.app itself it perfectly happy to send virtually unlimited text into a "target" that can handle it. I only used "pico" out of my own preference, all that really mattered was that the receiving target was "expecting" long input (like a text editor).

Returning to here:

When in terminal I run the command that reads user input from stdin, for example base64 , I can paste or type up to 1024 characters (bytes).

This limitation comes from how the shell and the underlying tty manage their I/O, not terminal.app. What you do about it... depends on what you're actually trying to do. This general issue is called "Line discipline", which is typically divided into "canonical" (line oriented and how the shell works) and "raw"/"non-canonical" (input is directly processed, which is how interactive apps like pico work). There are a variety of tweaks you can make to the terminal that will change how this behaves but I haven't actually played with them very much and they all have complicated tradeoffs. All of this is also well outside of the macOS architecture and is really common to all Unix system.

BTW, Terminal.app is still busy pasting my single line of text, even several minutes later. I'm not convinced it will work, but I can't bring myself to kill it yet.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

terminal input buffer size
 
 
Q