6

Is there a simple utility like printf that'll give me a "binary representation", i.e. a string like "01010010", from an input string? It would need to support multi-byte encodings.

13

xxd -b

(source)

  • Nice, thank you! My Google didn't find it… :o) – deceze Jul 30 '11 at 0:50
3

You can also do this (and many other things) using figlet with the binary font.

$ echo foo | figlet -f binary
01100110 01101111 01101111 
  • @bahamat: I love the style of figlets big font output (+1 for that :) , but I there is not 'binary' format for version 2.2.2.. – Peter.O Jul 30 '11 at 19:17
  • I'm using 2.2.4, and I have the binary font. You have to download it from figlet.org (I already posted the link). – bahamat Jul 30 '11 at 19:52
  • I downloaded binary.flf, and it works to just add a new .flf file to /usr/share/figlet... Now that I've actually tried it, I'll mention that unless you manually modify binary.flf, it does not convert spaces to binary... – Peter.O Jul 31 '11 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.