Click the virtual machine below to start practicing
- Setting up virtual machine…
- Preparing lab files…
- Starting terminal services…
This lab machine has stopped
Your progress through the guide is saved. Start a fresh machine to keep practicing.
Click the virtual machine below to start practicing
Your progress through the guide is saved. Start a fresh machine to keep practicing.
cat dumps a whole file at once, which is useless for anything long. less shows one screen at a time. ~/project/server.log has 500 lines, and one of them is an error you'll need to find.
This lab is the hands-on companion to the less lesson from Linux Journey (CC BY-SA 4.0).
less server.log
Inside less:
| Key | Does |
|---|---|
| Space / b | next / previous page |
| Down / Up | one line |
| g / G | start / end of file |
| q | quit |
Try them, then press q.
-N adds a number to each line:
less -N server.log
Leave it open for the next step.
In less, type / followed by a word and press Enter to search forward. n jumps to the next match.
Open the log with line numbers, search for ERROR, note its line number, and quit with q. Save the number in answer.txt:
echo <line-number> > answer.txt
A pipe | sends one command's output into another. Pipe a long listing into less:
ls -l /usr/bin | less
Press q when you're done.
less file shows a file one screen at a time; q quits.-N shows line numbers./word searches and n finds the next match.command | less pages through any output.