Search
Advertisement
Indian amateur golfers falter at international meets, for a reason

Longest Command In Crosh Online

Result: The cursor froze. Crosh did not crash, but it stopped accepting keyboard input for 3 seconds. After processing, the command executed.

# Generate a 32,767-character argument printf 'A%.0s' 1..32767 | xargs -0 echo Note: The above command requires xargs , which may not be available in stock Crosh. You have been warned. Did I miss a longer command? Do you know a hidden built-in that bypasses the limit? Let me know in the comments.

The command:

echo AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... (32,767 times) 0 Execution time: ~400ms (mostly rendering) Shell sanity after execution: Intact. Final Verdict The longest command in Crosh is 32,767 characters using an external binary, or 131,071 characters using a shell built-in.

Result: Error. Argument list too long .

But a "command" implies execution. So the official winner for executable command remains . The "Null Byte" Caveat If you try to inject a null byte ( \0 ) into Crosh via printf or binary piping, the command will truncate immediately. Crosh treats null as string termination, just like C. Practical Takeaway Unless you are trying to break the shell on purpose, you will never hit this limit. The average Crosh command ( ping , ssh , top , network_diag ) uses fewer than 200 characters.

Why this number? It is a classic computing limit: (the maximum value of a signed 16-bit integer). longest command in crosh

For example, using a printf built-in (or just pressing Tab to trigger auto-complete), the buffer limit becomes —that is 2^17 - 1 .

I decided to find out. In a standard Bash shell on Linux, the limit is usually around 128KB to 1MB (defined by ARG_MAX ). Crosh, however, is different. It is built on ash (Almquist shell) with a custom frontend running inside the Chrome browser process. Result: The cursor froze

echo [32,767 copies of the letter 'A'] At character 32,768, Crosh returns: