Out of curiosity, I did blame on some files in the FreeBSD source code (https://github.com/freebsd/freebsd). In core utilities like "cat", "kill" and "mv", there are still quite a few lines dating back all the way to the original commits of BSD 4.4 Lite source 24 years ago. Example:
And if you look at lines that were changed, quite often they are style changes/fixes.
Unfortunately, the easy-to-trace history doesn't go back further than that, but I think it's reasonable to assume that some of these lines, at least, could be dated back to before 1987.
But BSD was a rewrite too. I don't know what the mix of Unix versions in common use was 30 years ago, but I assume AT&T's original was up there. That's the version I started with around that time period.
I was actually assuming that most people today were running Linux, but I forgot that Macs use pieces of BSD.
As far as I know, BSD never did a complete rewrite touching every single line of code. They rewrote the code that was inherited, or derived from, AT&T Unix. Which was most of it, but not everything.
https://github.com/freebsd/freebsd/blame/e278a20c2ee54d8fa1a...
And if you look at lines that were changed, quite often they are style changes/fixes.
Unfortunately, the easy-to-trace history doesn't go back further than that, but I think it's reasonable to assume that some of these lines, at least, could be dated back to before 1987.