Difficulty: beginner
Estimated Time: 10-15 minutes

To start the tutorial click "START SCENARIO" <3

This tutorial will have several commands to run. Feel free to either type them out yourself into the terminal window on the right or click the command to run that command in the terminal window.

Always try to type these commands yourself as this will make it easier to get the hang of it!

We will be learning how to read files using a program called less

  • What a terminal pager program is
  • How to navigate through a text file
  • Searching a text file
Command Description
less A program to read text files

Amber Wright

Things we have covered:

  • What a terminal pager program is
  • How to navigate through a text file
  • Searching a text file
Command Description
less A program to read text files

Now you're ready to do other things - namely tutorial 3!

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Tutorial 2: Beginner's guide to pagers

Step 1 of 3

Step 1 - Opening and closing less

We are going to learn how to do is to open and read the contents of files.
We will be doing that in this tutorial using less, a terminal pager program. It is used primarily to read the contents of a file one screen (or page) at a time. less is installed on most unix and unix-like systems so is almost always available to use.

Just like before, let's try and run less on it's own:

less

You should see the following error message:

Missing filename ("less --help" for help)

We could find out how to run less by running it with --help but let's just try following the suggestion of adding a filename.

Hint: If you don't want to type out a filepath, you can tap tab to complete the command. Just type less ada_l and then click tab (Tab ↹) this should auto-complete the filename. We will touch on this in more detail another time.

less ada_lovelace_bio.txt

This will do something different to the terminal than you've experienced before. You can use the directional arrow on your keyboard ⇩ to scroll downwards through the file. Tap the ⇩ arrow until you reach the end of the file. You will be able to see you've reached the end when you see at the bottom of the screen:

(END)

You can also use the ⇧ to scroll up through the file.

When you feel comfortable scrolling up and down use

q

to quit the program - you will see that you are back on the command line again.