0
0
Linux CLIscripting~10 mins

less and more (paginated viewing) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to view the contents of a file named 'example.txt' one page at a time using the 'less' command.

Linux CLI
less [1]
Drag options to blanks, or click blank then click option'
A-n
B-r
C--help
Dexample.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like '-r' or '-n' without specifying the file.
Typing only 'less' without a file name.
2fill in blank
medium

Complete the command to view the output of 'dmesg' command one page at a time using 'more'.

Linux CLI
dmesg | [1]
Drag options to blanks, or click blank then click option'
Aless
Bmore
Ccat
Dhead
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cat' which outputs all at once.
Using 'head' which shows only the first few lines.
3fill in blank
hard

Fix the error in the command to view a file named 'log.txt' with 'less' and show line numbers.

Linux CLI
less [1] log.txt
Drag options to blanks, or click blank then click option'
A-N
B-n
C-l
D-h
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-n' which disables line numbers in 'less'.
Using '-l' or '-h' which are unrelated options.
4fill in blank
hard

Fill both blanks to create a command that shows the first 20 lines of 'data.txt' and then views it page by page.

Linux CLI
head [1] [2] data.txt | less
Drag options to blanks, or click blank then click option'
A-n
Bdata.txt
C20
D-20
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-20' instead of '-n 20' which is less clear.
Swapping the order of options and filename.
5fill in blank
hard

Fill all three blanks to create a command that searches for the word 'error' in 'system.log', ignoring case, and views the results page by page.

Linux CLI
grep [1] [2] [3] | less
Drag options to blanks, or click blank then click option'
A-i
Berror
Csystem.log
D-v
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-v' which inverts the match.
Swapping the order of search word and filename.