
What does "cat -" do on the Unix command line?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: tail myfile | cat - It's basically a null operation, since this is no different than doing: tail myfile
A lot of shell script authors use structures like this too: cat - << EOF
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.
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.
Categorized:
Unix and Linux Help
(Article 4137)
Tagged: Previous: Are there dangers in having high school students blog? Next: How do I subscribe to RSS feeds with Safari? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. Note that "cat -" is basically "cat" anyway. Posted by: monsieur at May 17, 2006 5:05 AMhi thanks Posted by: John at January 10, 2008 12:16 AMI have a lot to say, but ...
I do have a comment, now that you mention it!
|
Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|