Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
"File name too long" when printing a long base64 string. Why?
Downloading an image and encoding it into base64:
curl -o output.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/USA-San_Jose-De_Anza_Hotel-3.jpg/500px-USA-San_Jose-De_Anza_Hotel-3.jpg
IMG_BASE64=$(base64 -w 0 output.jpg)
$IMG_BASE64
Output:
[...]gw3kYhrA4NAHJliv7x+uPYjyxvzx7HHWf/Z: File name too long
Why does it say "File name too long"?
1 answer
The following users marked this post as Works for me:
| User | Comment | Date |
|---|---|---|
| Franck Dernoncourt | (no comment) | Oct 14, 2025 at 07:31 |
You're not printing it; you're trying to invoke the Base64. And since there isn't a PATH command that matches, your system is trying to look for a script file with that nonsense name to run.
Try this last line instead:
echo "$IMG_BASE64"
Or if you don't care about output.jpg, pipe the bits through base64 and whatever else you need.

1 comment thread