grep takes a file or (files) as its input, when no file name is given
grep reads from standard input (file descriptor 0).
When you do
ls | grep 'something', you are redirecting
ls command's standard output to
grep standard input via pipe (that's what
While in the later case when you just do
grep 'something', there no file name given and hence
grep will read its STDIN for input, no pipe is involved here so you need to type something on the STDIN (give input) to see the output.
% grep 46
As you can see
46 from my typed contents and showed it on STDOUT. BTW to close the interactive input session, press Ctrl + D which indicates EOF (End of File) (in this case read it as "End of Input").