OS function: providing a command-line interface (CLI)

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

OS function: providing a command-line interface (CLI)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. How does a user give instructions to a command-line interface (CLI)?
A By clicking icons and windows with a mouse
B By typing text commands
2. Which statement about using a CLI is correct?
A The user must remember the commands
B The CLI shows every available command as a button
3. Compared with a GUI, a CLI is usually...
A Harder for a beginner to learn
B Easier for a beginner to learn
4. Why do experienced users often like a CLI?
A It gives precise and quick control
B It needs no commands to be typed
5. Which interface uses fewer system resources such as RAM and processing power?
A GUI
B CLI

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1dir AThe command is misspelt. A CLI only accepts exact commands, so the computer reports an error instead of listing the files.
2del report.txt BA typed command that lists the files and folders in the current folder (ls on Linux and macOS)
3A CLI needs the user to remember exact commands and spell them correctly, so it is harder to learn than a GUI CThis describes a GUI. A CLI uses typed text commands, has no icons or menus, and is hard for beginners to learn.
4An expert can control the computer precisely and quickly by typing one line of text with no menus DA typed command that deletes the file called report.txt straight away, with no clicking
5C:\> dri Ecopy notes.txt backup\notes.txt
6A CLI is easy for beginners because it shows icons and menus to click Fdel *.tmp

Definitions

command-line interface (CLI)

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
$ __ Documents
2.
$ _____ homework
3.
$ __ notes.txt backup.txt
4.
$ __ old_notes.txt
5.
$ __ notes.txt photo.jpg

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A cdDocuments
B dir
C copy notes.txt backup
D del old.txt
Question 2
A cd Projects
B mkdr reports
C dir
D cd reports
Question 3
A OUTPUT command
B IF command = "dir" THEN
C OUTPUT "Listing files"
D ENDIF
Question 4
A WHILE command <> "exit"
B INPUT command
C OUTPUT "Running command"
D ENDIF
Question 5
A cd homework
B cp essay.txt
C ls backup
D rm essay.txt

Answer Key

OS function: providing a command-line interface (CLI)
Section A: Quick Questions
Q1
B — By typing text commands
Q2
A — The user must remember the commands
Q3
A — Harder for a beginner to learn
Q4
A — It gives precise and quick control
Q5
B — CLI
Section B: Match the Pairs
Q1
dir → A typed command that lists the files and folders in the current folder (ls on Linux and macOS)
Q2
del report.txt → A typed command that deletes the file called report.txt straight away, with no clicking
Q3
A CLI needs the user to remember exact commands and spell them correctly, so it is harder to learn than a GUI → copy notes.txt backup\notes.txt
Q4
An expert can control the computer precisely and quickly by typing one line of text with no menus → del *.tmp
Q5
C:\> dri → The command is misspelt. A CLI only accepts exact commands, so the computer reports an error instead of listing the files.
Q6
A CLI is easy for beginners because it shows icons and menus to click → This describes a GUI. A CLI uses typed text commands, has no icons or menus, and is hard for beginners to learn.
Section C: Definitions
Q1
command-line interface (CLI) — A user interface where you type text commands to control the computer. It is precise and quick for experts, uses few resources, but is harder to learn because commands must be remembered.
Section D: Fill in the Blanks
Q1
$ cd Documents
Q2
$ mkdir homework
Q3
$ cp notes.txt backup.txt
Q4
$ rm old_notes.txt
Q5
$ ls notes.txt photo.jpg
Section E: Spot the Error
Q1
A — A command and its argument must be separated by a space. It should be 'cd Documents'. The CLI cannot understand 'cdDocuments'.
Q2
B — CLI commands must be typed exactly. The command to make a folder is 'mkdir', not 'mkdr', so the computer would not recognise it.
Q3
A — A CLI works by the user typing a command, so the program must read it with INPUT, not display it with OUTPUT.
Q4
D — A WHILE loop must be closed with ENDWHILE, not ENDIF. The CLI loop keeps asking for commands until the user types exit.
Q5
B — The cp command needs both a source and a destination. The line should be 'cp essay.txt backup' so the file is copied to backup.