-1

I have a Microsoft Windows .exe file on my Linux Mint box. I would like to convert the contents into a .txt file, but in the binary (think of 1s and 0s) form.

I have found commands which want to convert it into hexademical, or other formats, which are outside the scope of my requirements.

Is there a command to do this on Linux?

plagiarism
  • 13
  • 6
  • It is not clear what you want to get. Linux doesn't rely on file extensions, e.g. .txt, as much as Windows does, but ".txt file" and "binary" seems contradicting. Please [edit] your question and explain what you want to achieve. What do you want to see in the resulting file or for what purpose do you need it? Adding an example might help. Maybe you can show a partial hex dump of the input file and the expected output. – Bodo Oct 25 '21 at 15:21
  • I have a file (which happens to be a .exe file) and I would like to convert it into a text document which contains only the 1's and 0's. – plagiarism Oct 25 '21 at 17:10

1 Answers1

0

You can use xxd to view binary or hexadecimal dumps

for binary

xxd -b {_file_}.exe

To get the output of this command inside a .txt file

xxd -b {_file_.exe} > {_file_}.txt

Akki
  • 96
  • 1
  • 7
  • That was a great answer, but I only wanted the binary. How can I remove the offset addresses, spaces, and ASCII representation? – plagiarism Oct 25 '21 at 23:16
  • On top of my head .. I would probably read that file in python in `b` mode and then write it to another file . – Akki Oct 26 '21 at 03:19