I have a binary that has to be copied over serial port to the device that has hexedit installed. How to get hex dump of the binary on Linux (preferably in Python) in a format that can be simply inserted into hexedit? Answer Restating the question a little, I think you want to generate a hex dump of a binary