Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

7.2 (2 of 4): Utility software

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

45 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

The disk is nearly full

Your laptop is slow. The disk is nearly full. You want to email a big folder, but it is too big to send. You also think you might have a virus.

What can you do? You use small helper programs. They are called utilities. They look after the computer, so that other programs can do their work.

Key words

WordWhat it meansExample
UtilityA small program that looks after the computer.A backup tool
File managementMaking, naming, moving, copying and deleting files and folders.File Explorer
FragmentedSplit into pieces that are far apart on a disk.A file in 50 pieces
DefragmenterA utility that joins each file's pieces together again.Defragment and Optimise Drives
LosslessCompression that keeps every bit of the data.ZIP
LossyCompression that throws away some detail for ever.JPEG, MP3
CompressionMaking a file smaller so it uses less space.A ZIP file
Package managerA utility that finds, installs, updates and removes software.The app store on a phone
MalwareSoftware made to harm a computer or steal data.A virus
FirewallA program that blocks unwanted data from reaching the computer.The Windows firewall
BackupA copy of files kept in another place.A copy on a cloud drive

The cells students fill in are left blank in this preview.

Match the utility to its job

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Quick check

Have a go

Quick check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Clear names and folders save time

A file manager shows your files in folders. You can make a folder, rename a file, move it, copy it, search for it and delete it.

Good habits save time. Give files clear names. Keep a folder for each subject. Do not keep ten copies of one file with names like "final2" and "final3".

A defragmenter joins the pieces of a file

A hard disk saves a file in whatever free space it finds. After many saves and deletes, one file can be in many pieces. The file is now fragmented. The disk must move to many places to read it, so it is slower.

A defragmenter moves the pieces so each file is in one place. This helps a magnetic hard disk. An SSD has no moving parts, so it does not need it.

Try it: how many pieces?

Code: python
# Each letter is a block of a file. A dash is free space.
disk = ["A", "-", "B", "A", "-", "B", "A"]
pieces = 0
last = "-"
for block in disk:
    if block == "A" and last != "A":
        pieces = pieces + 1
    last = block
print("File A is in", pieces, "pieces")

# Put the three A blocks next to each other and run it again.
# A defragmenter does that for every file.

Make a free account to save your work and track your progress.

Compression makes files smaller

Compression makes a file smaller. A smaller file saves space and is faster to send.

A ZIP file holds one or many files in a smaller space. You open it to get the exact files back. Compression is useful for storage, and for an email attachment that is too big.

Extra: Lossless and lossy

Lossless compression keeps every bit of the data. A ZIP file is lossless, so you get the exact file back.

Lossy compression throws away detail that people hardly notice. A JPEG photo or an MP3 song is lossy. You cannot get the lost detail back.

Extra: Worked example: shrink a message

StepWhat to doResult
1Start with the textAAAABBBCCD
2Count each run of the same letter: 4 A, 3 B, 2 C, 1 D4 3 2 1
3Write each count and then its letter4A3B2C1D
4Count the characters: 10 before, 8 after2 characters saved

The cells students fill in are left blank in this preview.

Extra: Try it: a simple compression idea

Code: python
# Write each run of the same letter as a count and the letter.
text = "AAAABBBCCD"
result = ""
previous = ""
count = 0
for letter in text:
    if letter == previous:
        count = count + 1
    else:
        if count > 0:
            result = result + str(count) + previous
        previous = letter
        count = 1
result = result + str(count) + previous
print(text, "becomes", result)

Make a free account to save your work and track your progress.

Extra: Make a file with lots of numbers

Command
seq 1 20000 > numbers.txt

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: Compress it with gzip

Command
gzip -kf numbers.txt

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: Compare the sizes

Command
ls -l numbers.txt numbers.txt.gz

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: What you saw

Note

The number in the fifth column is the size in bytes. The .gz file is much smaller, because the digits repeat a lot. gzip is lossless, so you can open the compressed file and get every digit back.

A package manager installs software

A package manager installs software from a trusted list. It also updates and removes it.

On Ubuntu it is called apt. You ask for a program by name. The package manager gets it and any other parts it needs.

Extra: More package managers

Note

Python has its own package manager, called pip. Windows has one called winget. The app store on a phone does the same job.

Extra: Count the installed packages

Command
dpkg -l | wc -l

A command for the lesson’s lab terminal. It is shown here and not run.

Block malware and keep a copy

Protection software includes anti-malware and a firewall. Anti-malware scans files for known malware. A firewall blocks unwanted data from reaching your computer.

Backup software copies your files to another place at set times. Keep one copy away from the room the computer is in.

Your turn: write a defragmenter

Write the function defragment. It gets a list of blocks. A letter is a block of a file. A dash is free space.

  1. Give back a new list.
  2. Put the blocks of each file together, in alphabet order. Use sort().
  3. Put all the free space at the end.

For example, ["A", "B", "A", "B"] becomes ["A", "A", "B", "B"]. Press Run Tests to check.

Code: python
def defragment(disk):
    # disk is a list of blocks. A letter is a block of a file. "-" is free space.
    # Give back a new list: the blocks of each file together (in alphabet order),
    # and all the free space at the end.
    return disk

Make a free account to save your work, or press Start lab to work through the whole lesson.

True or false?

Have a go

True or false?

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Final check

Have a go

Final check

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.