Line At A Time
Level 9: Reading a File
Reading a File Print what is inside a file.

cat prints a whole file to the screen. The name is short for "concatenate", because it can print several files one after another, but nine times out of ten it is used exactly like this: to peek inside one file.

shopping.txt has one item per line, and cat prints them exactly as they are stored. Keep this shopping list in mind: it comes back again and again in the lessons ahead.

Try cat pets.txt as well, and cat notes/jokes.txt: a name with a slash in it means "the file jokes.txt inside the folder notes", so you can read a file without walking over to it.

cat shopping.txtPrint the whole file.
cat notes/jokes.txtPrint a file inside another folder.
Your task
  • Read shopping.txt with cat
  • Read a file inside the notes folder

Open this level in your browser to type the commands at a live terminal that answers back.