Hello I would like to know the what exactly does cat - mean in Unix? I was recently reading through an article that mentioned this command and couldn’t understand what it did.
“cat” is the ‘concatenate’ program and its purpose is to display the contents of one or more file. Add the ‘-’ flag, however, and you have it display the content of “standard input” or “stdin”: in a pipe like:
It’s basically a null operation, since this is no different than doing:
A lot of shell script authors use structures like this too:
for what we script programmers call a here document, but most times this can be accomplished in other ways that are more resource efficient on the system.
In general, the cat - command is sometimes useful for shell scripting, but in general usage you’ll rarely, if ever, see it on a command line.