TOPIC 05/4016 MINNOT STARTED

Command line basics for testers

Search a log, follow it live, count errors with pipes and read exit codes, using a few commands that appear in every tester's day.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: texting instructions. Pointing at pictures on a screen is like using a menu. Typing a short message to the computer is like texting a helper. "Show me the lines with ERROR." The helper answers in plain text.

Daily List is a to-do list app. At night it sent a reminder to the wrong person. Tom has a log file with thousands of lines. He cannot read them all.

He opens a , a text window where you type instructions. He types a short command that asks for only the error lines. Three lines come back.

Then he asks the computer to show new lines as they arrive. He sends a test reminder and watches the log update live.

The picture has limits. A helper forgives a typing slip, but a computer does not. One wrong letter can give a different answer or no answer.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Using a few typed commands to find, count and follow lines in a log, and to read whether a command worked.

  1. Find the lines
  2. Count them
  3. Follow new ones
  4. Check the exit code
Find, count, follow, check the code

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
A text to a helperA typed command
Show me lines with a wordSearching with grep
Keep telling me new newsFollowing with tail
A thumbs up or downAn exit code

WHERE THIS PICTURE STOPS

  • A helper guesses what you mean. A computer takes your words exactly.
  • A text can be read later by anyone. A command output vanishes unless you save it.
  • A helper can say sorry. A command can delete files.

HOOK

Find, count, follow, check the code.

REMEMBER IT THIS WAY

A rule of thumb: if you see this, think that.

If a log has thousands of lines, usually search for the word ERROR before you read. Then watch new lines arrive while you send a test reminder.

What each part of the trick stands for
In the trickWhat it stands for
SearchSearching with grep
WatchFollowing with tail
ResultAn exit code

It misleads when the fault never logs the word ERROR, so the search finds nothing.

TELL A FRIEND

Texting a helper is like typing a command. You ask for lines with a word, for new lines as they come, and for a thumbs up or down at the end.

OFTEN MIXED UP WITH Reading logs for testers. The logs lesson says what a log line means. This lesson shows how to read a big log quickly.

PRACTISE AND KEEP

Sources for this topic — 4 sources
  1. Market practice

    grep, searching for a pattern (GNU grep 2.4 manual) ↗ — GNU Project · grep searches files for lines that match a pattern; options include counting and inverting matches (search excerpt, page not opened)

    Says grep prints the lines of its input that match a pattern, with options such as count and invert. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: grep 2.4, an old edition. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    tail invocation (Coreutils manual) ↗ — GNU Project · tail follow mode keeps reading as a file grows; follow by name copes with a renamed file (search excerpt, page not opened)

    Documents tail follow mode, which keeps reading as a file grows, and the option to follow by name when a file is renamed. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Market practice

    ps(1), Linux manual page ↗ — man7.org · ps reports a snapshot of the current processes, with pid and comm output fields (search excerpt, page not opened)

    Describes ps as a report of a snapshot of the current processes, with pid and comm output fields. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  4. Market practice

    Select-String (PowerShell documentation, Microsoft) ↗ — Microsoft · Select-String finds text in files and has options such as Context, NotMatch and Quiet (search excerpt, page not opened)

    Lists Select-String options such as Context, NotMatch and Quiet for finding text in files. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.