Question: How do I create an **unmodified** hex dump of a binary file in Linux using bash? The `od` and `hexdump` commands both insert spaces in the dump and this is not ideal.

Is there a way to simply write a long string with all the hex characters, minus spaces or newlines in the output?

Answer: 
```
xxd -p file

```

Or if you want it all on a single line:

```
xxd -p file | tr -d '\n'

```
The other answers are preferable, but for a pure Bash solution, I've modified the script in [my answer here](https://stackoverflow.com/questions/2003803/show-hexadecimal-numbers-of-a-file/2004276#2004276) to be able to output a continuous stream of hex characters representing the contents of a file. (Its normal mode is to emulate `hexdump -C`.)