"cat < file.txt" or "cat file.txt"?

Learning the Command Line - Redirection - Exercise 5

I have the same question as the one seen in the above post. However, the answer there does not make sense to me. Could someone please explain. Thanks!

if i understand it right, cat filename.txt will read the file. if you use < no file is specified. so cat will read the standard input (stdin), which is provided by <.

in the end the difference is minimal in this scenario.

1 Like

The manual page I copied that answer from is clear. It concatenates files or from standard input if no files are provided. That’s what it says, go back and read it! You can also bring that text up yourself with $ man cat, and indeed that is also one of the first places to look up information about a command, something you must do a lot as you can’t just know it all.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.