I looked up a Unix book, the man and the wikipedia page for tr but could not find a reason why it was designed/implemented in such way that it does not read from file but strictly only from the standard input. For instance, tools such as wc, grep, sed, and awk all will happily read input from file if provided or from standard input. Was/Is there a compelling reason to design tr this way?

  • 2
    It was not coded that way, and life goes on... I suspect it must be due being another time with machines with severe memory restrictions, and tr is old. Unix utilities also were designed by several people, and well there are several inconsistencies and duplication of functionality across utilities. Commented Oct 26, 2016 at 0:38
  • 3
    just to point out: this question has been flagged as primarily opinion-based but IMHO it shouldn't be closed; we've had questions similar to this on why things are implemented in whatever way that have very valid answers. see for example unix.stackexchange.com/questions/6804/what-does-dd-stand-for or unix.stackexchange.com/questions/93773/why-is-sort-o-useful
    – strugee
    Commented Oct 26, 2016 at 2:35
  • 3
    It is now out of the review queue, but still sitting perilously on 4 close votes - if it does get the last one, please ping me here so I can vote to reopen. Commented Oct 26, 2016 at 6:22
  • 3
    @strugee I disagree. Yes, us speculating sure are just opinion... but since there may still be people out there who actually know - or remember reading/hearing a first-hand account - it is a question it may be possible to answer. 1970 isn't that long ago. Commented Oct 26, 2016 at 6:30
  • 6
    Unix inherited tr from Multics as a derivative of PL/1 translate built-in function, which in turn was a generalization of a TR command in System/360 architecture (see IBM System-360 Green Card). Worth noting that QNX implementation could actually read from a file via -r Commented Nov 1, 2016 at 0:33

1 Answer 1


The UNIX philosophy advocates for "small, sharp tools", so the answer is that reading from a file would be bloat contrary to the UNIX philosophy. As to why wc, grep, sed, awk, etc do read from files, the answer is that they all have features that require more than one input or input selection or otherwise require direct access to the files. As tr is not commonly used for those reasons you are left with one of the following forms to meet your needs;

tr ... < file
tr ... < file > file2
tr ... < file | sponge file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .