Where to start First steps track · 15 stages
Linux Labs

Bash: text processing and scripts

Searching and editing text with grep, sed and awk, your own scripts with arguments and checks, exit codes and scheduled runs with a log and a lock.

9 stages4 labs~5 hours medium medium

Progress Stages: 0 of 9

The track has not been started. The first stage is «Regular expressions in grep», ~30 min.

Start stage 1

Module 1

Searching and editing text

Patterns instead of an exact substring, editing lines by address without an editor and sums over fields.

3 stages · ~2 hours

  1. Stage 1 of 9

    1 · Regular expressions in grepRegular expressions in grep

    6 steps · ~30 min 6 steps · ~30 min
    1. The night log exercises 0 of 1 on a machine 5 min
    2. 2 A match anywhere in the line on a machine 6 min
    3. 3 Several alternatives in one pattern on a machine 5 min
    4. 4 Cutting out the match on a machine 7 min
    5. 5 Who is guessing passwords on a machine 5 min
    6. 6 Summary summary 2 min
  2. Stage 2 of 9

    2 · sed and awk: editing and fields of a streamsed and awk: editing and fields of a stream

    9 steps · 2 labs · ~1 hour 9 steps · 2 labs · ~1 hour
    1. Thirty configs exercises 0 of 1 on a machine 5 min
    2. 2 Stream, replacement, address on a machine 5 min
    3. 3 Editing in place on a machine 6 min
    4. 4 Columns and a sum on a machine 5 min
    5. 5 A sum for every client on a machine 4 min
    6. 6 Refunds by client on a machine 3 min
    7. 7 A report from the nginx log medium lab 30 min
    8. 8 Change an address in every config medium lab 25 min
    9. 9 Summary summary 2 min
  3. 3 · Module test 10 questions · pass mark 70%

Module 2

Scripts: arguments and conditions

How to run your script as a command, pass it arguments with spaces and check files before working with them.

3 stages · ~2 hours

  1. Stage 4 of 9

    4 · A script is a file of commandsA script is a file of commands

    6 steps · ~30 min 6 steps · ~30 min
    1. A script from a colleague exercises 0 of 1 on a machine 4 min
    2. 2 Who reads the script on a machine 7 min
    3. 3 The x permission and lookup by name theory 5 min
    4. 4 A variable and quotes on a machine 8 min
    5. 5 Your own command on a machine 4 min
    6. 6 Summary summary 2 min
  2. Stage 5 of 9

    5 · Arguments, quotes and file checksArguments, quotes and file checks

    7 steps · 1 lab · ~55 min 7 steps · 1 lab · ~55 min
    1. A file with a space in its name exercises 0 of 1 on a machine 4 min
    2. 2 A script's arguments on a machine 8 min
    3. 3 Testing a file before using it on a machine 7 min
    4. 4 The exit status and the usage line theory 5 min
    5. 5 A copy script on a machine 4 min
    6. 6 Fix the report script medium lab 25 min
    7. 7 Summary summary 2 min
  3. 6 · Module test 9 questions · pass mark 70%

Module 3

Reliable scripts

A check that sees a failure by the command's exit status, and a script run by a systemd timer — with a log and protection from a double start.

3 stages · ~2 hours

  1. Stage 7 of 9

    7 · Exit status and a healthcheckExit status and a healthcheck

    8 steps · 1 lab · ~55 min 8 steps · 1 lab · ~55 min
    1. The check says OK exercises 0 of 1 on a machine 4 min
    2. 2 Exit status on a machine 6 min
    3. 3 A condition on a command's status theory 4 min
    4. 4 An error answer is still an answer on a machine 6 min
    5. 5 set -e, set -u and pipefail theory 5 min
    6. 6 Fix the check on a machine 3 min
    7. 7 Write a healthcheck to a contract medium lab 25 min
    8. 8 Summary summary 2 min
  2. Stage 8 of 9

    8 · A script on a schedule: environment, log, lockA script on a schedule: environment, log, lock

    6 steps · ~30 min 6 steps · ~30 min
    1. Works by hand, fails as a service exercises 0 of 1 on a machine 5 min
    2. 2 A service's environment on a machine 7 min
    3. 3 The script's log theory 5 min
    4. 4 Two copies at once on a machine 8 min
    5. 5 A backup on the timer on a machine 3 min
    6. 6 Summary summary 2 min
  3. 9 · Module test 10 questions · pass mark 70%
  1. Final test 18 questions · pass mark 80%
Loading…