I have object of class

class X { 
  private DateTime dt; 

  "constructor, set/get" 

I have one instance of this object serialized in file.bin.

I want to show content of `file.bin on the Linux console in human readable way.


You can display the contents of a file with cat, but with binary files that will often result in "garbage". For binary files you can use od -x (or xxd):

od -x file.bin

that makes everything byte readable as hex words for any file (understanding what that means is more difficult and dependent on the program that wrote the file, but fortunately that is not what you asked for).

  • Tiny: od defaults to octal words; for hex bytes use -t x1. Also: Java serialized data is defined mostly by the Java infrastructure and not by the application: see docs.oracle.com/javase/8/docs/platform/serialization/spec/… (or earlier). Jan 24 '15 at 12:03
  • @dave_thompson_085 Thanks for pointing that out, I'm mostly using xxd, but that doesn't seem to be available everywhere. An application still determines which library/framework/service it uses to write out the binary, few frameworks do anything without an application, so the app IMO still determines what happens (but that is semantics).
    – Anthon
    Jan 24 '15 at 12:26

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.