I stumbled upon an interesting tidbit the other day. I was trying to take a screenshot of my Android phone while it was playing the boot animation. Of course I tried the standard adb tools:
adb shell screencap -p /sdcard/screencap.png
To which I would follow with an adb pull to get the file. However, since this was during an Oreo bring-up, Some things still were not right, and it couldn’t create the screenshot due to not finding the /sdcard. So I Googled a bit, and found this command:
adb shell screencap -p | sed ‘s|\r$||’ > screenshot.png
Which gave me a file, but it was corrupt and wouldn’t work. Further tinkering and searching, I found that it needed to take care of two carraige returns, like so:
adb shell screencap -p | sed ‘s|\r\r$||’ > screenshot.png
And voila! Now it works!
Linux – keep it simple.