16 04 | 2012

“Everything is a file” rocks

Written by Tanguy

Classified in : Homepage, Debian, Command line, Miscellaneous

Licence plate with “UNIX” written, subtitle “live free or die”

Unix rocks, or at least one of its design feature does: everything is a file.

Here is one funny use of that feature. I consider that programs that manipulate text should basically take it on their standard input, and write it to their standard output, while specifying the name of an input or output file should be an optional refinement.

Well, at least one program was designed the other way: when used to import a foreign key, ssh-keygen -i has no option to read it on its standard input. No problem, this can be worked around:

# ssh-keygen -if /dev/stdin
[paste the foreign key here]

Unfortunately, that does not work with every action of ssh-keygen since not all of them were written to be able to handle streams, which cannot be rewound.

Archives