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'

```
You can use Python for this purpose:

```
python -c "print(open('file.bin','rb').read().hex())"

```

...where `file.bin` is your filename.

Explaination:

1. Open `file.bin` in `rb` (read binary) mode.
2. Read contents (returned as `bytes` object).
3. Use `bytes` method `.hex()`, which returns hex dump without spaces or new lines.
4. Print output.