• Home
  • Store
  • Blog
  • Contact
  • Home
  • Store
  • Blog
  • Contact
  • #linux
  • |
  • #commandline
  • |
  • #softwareengineering
  • |
  • #embeddedsystems
  • |
  • #compilers
  • ...
  • View All >>

Intro To 'cat' Command In Linux

2023-04-28 - By Robert Elder

     I use the 'cat' command to read the contents of multiple files at once:

cat file1.txt file2.txt file3.txt

     I can type one or more file names after the cat command, and the contents of these files will be printed one after another on the terminal.  For example, let's first create two files that contain lists of names.  In the file 'names1.txt', we'll put:

Branden McKenna
Verity Jayda
Christopher Rene
Justy Kaiden

     and in the file 'names2.txt' we'll put:

Triston Issy
Ralphie Birdie
Alec Jacqueline

     I can use the cat command to print out each file individually, or I can use it to print out both files together:

cat names1.txt

     Outputs:

Branden McKenna
Verity Jayda
Christopher Rene
Justy Kaiden
cat names2.txt

     Outputs:

Triston Issy
Ralphie Birdie
Alec Jacqueline
cat names1.txt names2.txt

     Outputs:

Branden McKenna
Verity Jayda
Christopher Rene
Justy Kaiden
Triston Issy
Ralphie Birdie
Alec Jacqueline

     I can also use the 'cat' command to print out all of the lines in both files and pipe them into the sort command to have them sorted alphabetically:

cat names1.txt names2.txt | sort

     Outputs:

Alec Jacqueline
Branden McKenna
Christopher Rene
Justy Kaiden
Ralphie Birdie
Triston Issy
Verity Jayda

     And that's why the 'cat' command is my favorite Linux command.

Intro To 'stty' Command In Linux
Published 2023-10-04
$1.00 CAD
Terminal Block Mining Simulation Game
Intro To 'nproc' Command In Linux
Published 2023-07-15
Intro To 'comm' Command In Linux
Published 2023-09-06
How To Force The 'true' Command To Return 'false'
Published 2023-07-09
A Surprisingly Common Mistake Involving Wildcards & The Find Command
Published 2020-01-21
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
Published 2019-08-01
Intro To 'chroot' Command In Linux
Published 2023-06-23
Join My Mailing List

Privacy Policy
Why Bother Subscribing?
  • Free Software/Engineering Content. I publish all of my educational content publicly for free so everybody can make use of it.  Why bother signing up for a paid 'course', when you can just sign up for this email list?
  • Read about cool new products that I'm building. How do I make money? Glad you asked!  You'll get some emails with examples of things that I sell.  You might even get some business ideas of your own :)
  • People actually like this email list. I know that sounds crazy, because who actually subscribes to email lists these days, right?  Well, some do, and if you end up not liking it, I give you permission to unsubscribe and mark it as spam.
© 2025 Robert Elder Software Inc.
Privacy Policy      Store Policies      Terms of Use