By "Bayer data", OP means Bayer image data, that is, image data which wasn't demosaiced. Look at e.g.:
-
Imatest docs -> "undemosaiced (Bayer) data"
-
Processing-RAW-Images-in-MATLAB-Sumner.pdf -> "Bayer CFA data"
-
Picamera Raw Bayer data captures -> "raw Bayer data recorded by the camera’s sensor"
-
"bayer data" site:magiclantern.fm ...

This kind of image data is what you get with "dcraw -4 -E". For a CR2, the pixel values output by that dcraw command are actually the exact values encoded in the CR2 file, after lossless decompression. For an uncompressed DNG (such as one saved by ML's silent picture module), the pixel values obtained by using that command are the exact values saved in the DNG. Same for a lossless DNG - pixels output by that dcraw command are the actual pixel values that were encoded when creating the DNG - without any image processing applied.
The only thing "dcraw -4 -E" does is to extract the image data (by parsing and unpacking/decompressing the input file),
without applying any kind of image processing. That command will output the actual image data encoded in the CR2 file, into a 16-bit
PPM PGM (which you can further process in Octave, for example). Or a 16-bit TIFF if you also use -T.
[...] Use dcraw -E -4 to get the raw pixel values. [...]
-d Show the raw data as a grayscale image with no interpolation.
Good for photographing black-and-white documents.
-D Same as -d, but with the original unscaled pixel values.
-E Same as -D, but masked pixels are not cropped.
With LibRaw, the above options were removed from
dcraw_emu - apparently the
unprocessed_raw command does what OP wants, but I didn't try it.
Now, the data that can be encoded into a CR2 or DNG might be either unprocessed / minimally processed by the camera (which is what Imatest calls "Camera RAW"), or it might be further processed - for example, our Dual ISO conversion tool (cr2hdr) outputs non-demosaiced (Bayer) image data as DNG. In the latter case, the image data is obviously not RAW.
So, if you know a better name for the nonexistent thing that we used to call "Bayer data", please enlighten us

To summarize:
- to extract the unprocessed image data from a CR2 or DNG: "dcraw -4 -E" or "unprocessed_raw"
- to view the CR2/DNG metadata: exiftool (as
answered previously) or exiv2
- to interpret the low-level CR2/DNG file contents yourself: hex editor, or... highly recommended: "exiftool -htmlDump".