10

This is the thing bugging me. I'd like to see some of my files in binary or plaintext format, but I can't figure out how to do it for all files. I can open some image files in plaintext using Textedit, but that's all I can figure out. Anyone know anything?

waiwai933
  • 2,483
  • 7
  • 28
  • 44

8 Answers8

17

Use "od -h filename | less" in your Terminal.app.

emmby
  • 1,197
  • 3
  • 12
  • 19
  • I like that I don't have to learn emacs or download a new app with this answer -- in my opinion its the most succinct and best time-saver. – NonCreature0714 Sep 22 '19 at 19:40
6

To read binary/text file:

xxd file.jpg 
Zimba
  • 1,051
  • 11
  • 15
4

I'd recommend BBEdit (used to be TextWrangler) as a good general purpose plain-text editor. If you have this in the Dock, you can drag any file on to it and the file will be opened as plain text.

Capripot
  • 115
  • 5
Ben Lings
  • 1,475
  • 1
  • 16
  • 19
2

You can use Emacs hexl-mode.

In the terminal, type 'emacs' and the name of the file you want to open. When emacs opens up the file, type option-x hexl-mode.

Richard Hoskins
  • 12,245
  • 10
  • 49
  • 52
1

I use HexEdit for this sort of thing. It can open any file and give you its hex and plaintext representation.

hbw
  • 481
  • 1
  • 5
  • 10
1

The editor of my choice for these kinds of things is Smultron.

Fabian Steeg
  • 166
  • 2
  • 4
1

You can always drop into a Terminal shell session, and use cat or hexdump to view any file as a text or hexadecimal file.

TextEdit will also display plain text files (as will about any other text editor, as noted by others).

0

Open the file with TextEdit - the plain text editor on MacOS - I was surprised it worked after trying for many days, many ways from many sources