Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the cat command. It’s one of the most basic Linux commands, though it’s used for two very different operations and not everyone is likely familiar with the second.
The cat command is mostly used to display text files. If a file has a thousand lines, those lines are going to whiz by the screen very quickly and leave you staring at the bottom of a file. For a relatively short file, cat will work just fine. For longer files, you might be better off paging through them with a command like more.
The other thing that the command does is what is implied by its name. “Cat” doesn’t mean “cat” as in “meow”, but refers to the command’s ability to concatenate files – creating one file that is a merge of several. For that, you would use a command like this:
So we have three one-line files and then use a command to create a new file that contains all of them.
That’s your Linux tip for the cat command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.