Chapter 13
Stream A File (cat)

You're going to do some more setup for this one so you get used to making files in one program and then accessing them from the command line. With the same text editor from Exercise 12, create another file named ex13.txt but this time save it directly to your temp directory.

13.1 Do This


Source 23: Linux/Mac OSX Exercise 13
  $ less ex13.txt
  [displays file here]
  $ cat ex13.txt
  I am a fun guy.
  Don't you know why?
  Because I make poems,
  that make babies cry.
  $ cat ex12.txt
  Hi there this is cool.
  $


Source 24: Windows Exercise 13
  > more ex13.txt
  [displays file here]
  > cat ex13.txt
  I am a fun guy.
  Don't you know why?
  Because I make poems,
  that make babies cry.
  > cat ex12.txt
  Hi there this is cool.
  >

Remember that when I say [displays file here] I'm abbreviating the output of that command so I don't have to show you exactly everything.

13.2 You Learned This

Do you like my poem? Totally going to win a Nobel. Anyway, you already know the first command, and I'm just having you check that your file is there. Then you cat the file to the screen. This command just spews the whole file to the screen with no paging or stopping. To demonstrate that, I have you do this to the ex12.txt which should just spew a bunch of lines from that exercise.

13.3 Do More

  1. Make a few more text files and work with cat.
  2. Unix: Try cat ex12.txt ex13.txt and see what it does.
  3. Windows: Try cat ex12.txt,ex13.txt and see what it does.


Online Video Course + PDF For $9

For the price of most other course's PDFs only, you can get the full PDF for this class and 2 videos demonstrating the whole book for both Unix/OSX Terminal and Windows PowerShell. The course is self-paced so you can go through it any time you want, as many times as you want.


Signup Now At Udemy.com For $9