Snowball
Snowball

Reputation: 1238

Is there a character limit of the output

I am outputting a base64 encoding of large image files in the command line with imagemagick. I am curious whether there is a character limit on the standard output(1) in the command line in linux. I am using Ubuntu 14.04.

Upvotes: 2

Views: 6810

Answers (3)

Thomas Dickey
Thomas Dickey

Reputation: 54525

Actually there is a limit, but you are unlikely to hit it with an image file: the standard output is (usually) not opened with "large file" support. This is an issue when redirecting to a file or a pipe (your output could fail at the 4GB size).

The limits for pipes alluded by @Dale to refer to the amount which can be in a pipe before the reader sees the data.

In any case, the filesize will be limited by the available disk space.

Encoding in base64 does not change any of that, except that you will use more space, however the output is used.

Upvotes: 0

blue112
blue112

Reputation: 56472

There's no limit of stdout.

If you want to make sure of that, just try:

cat /dev/urandom > somerandomfile

It will rapidly fill up your disk.

Please also note that by default, in a standard C program, stdout is buffered on newline, and there is a buffer limit size.

Upvotes: 1

nishantjr
nishantjr

Reputation: 1820

No. Although terminals don't perform so well with extremely long lines.

Upvotes: 0

Related Questions