Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • In #2, the cat command "blocks" writing to its standard output until more says it's ready for more input
    • This "write until block" / "read when input available" behavior makes streams a very efficient means of inter-process communication.
  • In #1, more can report how much of the file has been read, e.g. --More-- (24%) because it has access to the size information for the file it is reading.
    • But in #2, the text is "anonymous input" – from standard input – so more doesn't know how much of the total has been provided.

...

Tip

Note the slight difference when you give wc -l a file name versus when you pipe input to it.

  • wc -l <filename> displays the number of lines then the file name.
  • cat <filename> | wc -lonly displays the number of lines in its anonymous input from standard input.

What is text?

We've talked about viewing text using various Unix commands – but what exactly is text? That is, what is stored in files that the shell interprets as text?

...