Cat Command

Mike Hudson mike.hudson at
Wed Mar 15 03:34:56 GMT 2006


On Mar 14, 2006, at 6:41 PM, Lord Sauron wrote:

> Back in the /dev/null discussion there was some talk of the "cat"
> command (or something like that).  What's that?

cat is short for conCATenate.  It's basically a way to say "read this  
file, and spit the contents into standard output.

One way to copy a file would be: "cat file1.txt > file2.txt"

Also, since most programs will handle a stream from another program  
as input, you could cat a file into grep instead of telling grep to  
search through a file.

	cat file1.txt |grep -i string

I have heard that you can "cat" an uncompressed sound file into your  
audio device in /dev/... to have it play the sound to your speakers,  
though I've never tried.  I think the device expects AIFF, not WAV,  
but I am not certain.

I'm sure there's an example that would actually save you time, but I  
can't think of one at the moment.

Probably the most valuable linux tip anyone can give you is: the  
"man" system is your friend.  Any time you see a command and you  
don't know what it does, you can try typing "man command" into the  
terminal to find out.  It's very rare that there's no man page for a  
command.  There are even man pages for configuration files, which are  
extremely informative.

You can also type "man command" into google and a man page will be  
one of the first results.  Be careful, though, as sometimes the  
command you're using will differ from the one posted online.  For  
best results, run man from the command prompt of the system you're  
working on.

I hope this helps!

Best Regards,
Michael Hudson

More information about the kubuntu-users mailing list