Various people have answered some aspects of the query, but not all.
All files on computers are stored as 1's and 0's. Images, text files, music, executable applications, object files, etc.
They are all 0's and 1's. The only difference is that they are interpreted differently depending upon what opens them.
When you view a text file using cat
, the executable (cat
in this case) reads all the 1's and 0's and it presents them to you by converting them into characters from your relevant alphabet or language.
When you view a file using an image viewer, it takes all the 1's and 0's and turns them into an image, depending on the format of the file and some logic to work it all out.
Compiled binary files are no different, they are stored as 1's and 0's.
arzyfex's answer gives you the tools to view those files in different ways, but reading a file as binary works for any file on a computer, as does viewing it as octal, or hex, or indeed ASCII, it just might not make sense in each of those formats.
If you want to understand what an executable binary file does, you need to view it in a way which shows you the assembler language (as a start), which you can do using,
objdump -d /path/to/binary
which is a disassembler, it takes the binary content and converts it back into assembler (which is a very low level programming language). objdump
is not always installed by default, so may need to be installed depending on your Linux environment.
Some external reading.
NB: as @Wildcard points out, it's important to note the files don't contain the characters 1 and 0 (as you see them on the screen), they contain actual numeric data, individual bits of information which are either on (1) or off (0). Even that description is only an approximation of the truth. They key point is that if you do find a viewer which shows you the 1's and 0's, even that is still interpreting the data from the file and then showing you the ASCII characters for 0 and 1. The data is stored in a binary format (see the Binary number link above). Pierre-Olivier's community wiki entry covers this in more detail.