Tab completion is a feature that helps you finish typing commands, file names, or directories by pressing the Tab key. It saves time and reduces typing errors.
Click to reveal answer
beginner
How do you use tab completion to complete a file name?
Start typing the beginning of the file name, then press the Tab key. If there is only one match, it will complete the name for you. If there are multiple matches, pressing Tab twice shows all options.
Click to reveal answer
beginner
What happens if you press Tab twice and multiple completions are possible?
The shell lists all possible completions that match what you typed so far. This helps you see your options and choose the right one.
Click to reveal answer
beginner
Can tab completion be used for commands as well as file names?
Yes! You can use tab completion to finish typing commands, directory names, file names, and even options in some shells.
Click to reveal answer
beginner
Why is tab completion helpful for beginners?
It reduces typing effort, helps avoid mistakes, and teaches you the correct names of commands and files by showing possible completions.
Click to reveal answer
What key do you press to activate tab completion in the Linux shell?
ATab
BEnter
CSpace
DCtrl
✗ Incorrect
Pressing the Tab key triggers tab completion to help finish typing commands or file names.
If multiple files start with the same letters, what happens when you press Tab once?
ANothing happens
BThe shell completes the name fully
CThe shell completes up to the common part
DThe shell deletes what you typed
✗ Incorrect
The shell completes the name up to the part common to all matches.
How do you see all possible completions when multiple matches exist?
APress Tab once
BPress Tab twice quickly
CPress Enter
DPress Ctrl+C
✗ Incorrect
Pressing Tab twice quickly lists all possible completions.
Can tab completion help with completing command options?
AOnly for environment variables
BNo, only file names
COnly for directories
DYes, in some shells
✗ Incorrect
Some shells support tab completion for command options as well.
Why is tab completion useful for new Linux users?
AIt helps avoid typing errors and saves time
BIt makes the terminal colorful
CIt disables commands
DIt slows down typing
✗ Incorrect
Tab completion helps avoid mistakes and saves time by finishing words for you.
Explain how tab completion works when you start typing a file name in the Linux shell.
Think about what happens when you press Tab once or twice.
You got /4 concepts.
Describe two benefits of using tab completion for someone new to the Linux command line.
Consider how tab completion helps with typing and learning.
You got /4 concepts.
Practice
(1/5)
1. What does pressing the Tab key once do in a Linux terminal?
easy
A. Automatically completes the command or filename if there is only one match
B. Deletes the current command line
C. Opens a new terminal window
D. Runs the current command immediately
Solution
Step 1: Understand the function of Tab key in terminal
Pressing Tab once tries to complete the command or filename you are typing if there is only one possible match.
Step 2: Differentiate from other keys
Other options like deleting or running commands are not triggered by Tab key.
Final Answer:
Automatically completes the command or filename if there is only one match -> Option A
Quick Check:
Tab once = auto-complete [OK]
Hint: Tab once completes if only one match exists [OK]
Common Mistakes:
Thinking Tab runs the command
Confusing Tab with deleting text
Assuming Tab opens new windows
2. Which of the following is the correct way to trigger tab completion for filenames in a Linux terminal?
easy
A. Press Ctrl+C
B. Press Enter key twice
C. Press Tab key once or twice
D. Press Esc key
Solution
Step 1: Identify the key used for tab completion
The Tab key is used to complete filenames or commands in the terminal.
Step 2: Understand usage of pressing Tab once or twice
Pressing Tab once tries to complete if one match exists; pressing twice shows all possible matches.
Final Answer:
Press Tab key once or twice -> Option C
Quick Check:
Tab key triggers completion [OK]
Hint: Use Tab key once or twice for completion or options [OK]
Common Mistakes:
Pressing Enter instead of Tab
Using Ctrl+C which cancels commands
Pressing Esc which does nothing for completion
3. You have files named report1.txt, report2.txt, and report_final.txt in your directory. You type cat rep and press Tab twice. What will happen?
medium
A. The terminal will give an error
B. The terminal will show all files starting with 'rep'
C. The terminal will complete to 'report1.txt' automatically
D. Nothing will happen
Solution
Step 1: Understand double Tab behavior
Pressing Tab twice after partial typing shows all possible matches starting with that text.
Step 2: Apply to given files
Since multiple files start with 'rep', the terminal lists all matching files.
Final Answer:
The terminal will show all files starting with 'rep' -> Option B
Quick Check:
Double Tab = list matches [OK]
Hint: Double Tab lists all matching files [OK]
Common Mistakes:
Expecting auto-completion with multiple matches
Thinking it causes an error
Assuming no response on double Tab
4. You try to use tab completion but nothing happens when you press Tab. What could be the reason?
medium
A. There are no matching commands or files to complete
B. You pressed Tab too quickly
C. The terminal is frozen
D. Tab completion is disabled by default in Linux
Solution
Step 1: Check if matches exist
Tab completion only works if there is at least one matching command or filename.
Step 2: Understand other options
Pressing Tab quickly or terminal freezing are unrelated; Tab completion is enabled by default in most shells.
Final Answer:
There are no matching commands or files to complete -> Option A
Quick Check:
No matches = no completion [OK]
Hint: No matches means Tab does nothing [OK]
Common Mistakes:
Thinking Tab completion is off by default
Blaming terminal freeze without checking
Assuming speed of pressing Tab matters
5. You want to list all files starting with doc in a directory, but you only remember part of the filename. You type ls doc and press Tab twice but see too many options. How can you narrow down the tab completion results?
hard
A. Use the Up arrow key to see previous commands
B. Press Ctrl+Z to pause the terminal
C. Restart the terminal and try again
D. Type more characters after 'doc' before pressing Tab again
Solution
Step 1: Understand how tab completion filters matches
Typing more characters narrows down the possible matches for tab completion.
Step 2: Apply this to the problem
Adding more letters after 'doc' before pressing Tab reduces the list of files shown.
Final Answer:
Type more characters after 'doc' before pressing Tab again -> Option D
Quick Check:
More chars = fewer matches [OK]
Hint: Add more letters before Tab to narrow matches [OK]
Common Mistakes:
Pressing Ctrl+Z which suspends processes
Restarting terminal unnecessarily
Using Up arrow which recalls commands, not files
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.