0
0
Linux CLIscripting~20 mins

nano text editor in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Nano Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of the nano command when opening a new file?
You run the command nano newfile.txt in a terminal where newfile.txt does not exist. What will nano display?
Linux CLI
nano newfile.txt
AA prompt asking if you want to create the file before opening nano.
BAn error message saying "File not found" and nano exits immediately.
CThe contents of the last edited file open in nano.
DAn empty editor screen with the message "New Buffer" at the top and the nano help menu at the bottom.
Attempts:
2 left
💡 Hint
Think about what happens when you open a file that doesn't exist in nano.
💻 Command Output
intermediate
1:00remaining
What happens when you press Ctrl+O in nano?
While editing a file in nano, you press Ctrl+O. What does nano do?
AIt exits nano without saving changes.
BIt opens a new file for editing.
CIt saves the current contents to the file and prompts for confirmation of the filename.
DIt copies the selected text to the clipboard.
Attempts:
2 left
💡 Hint
Ctrl+O is often used for output or saving in editors.
🔧 Debug
advanced
1:30remaining
Why does this nano command fail to open the file?
You run nano /root/secret.txt as a normal user and get a "Permission denied" error. Why?
Linux CLI
nano /root/secret.txt
ABecause the user does not have permission to read or write files in the /root directory.
BBecause nano does not support opening files outside the home directory.
CBecause the file /root/secret.txt does not exist.
DBecause nano requires the file to be owned by the user running it.
Attempts:
2 left
💡 Hint
Consider Linux file permissions and user privileges.
🚀 Application
advanced
1:30remaining
How to search for a word in nano?
You want to find the word "apple" in a file opened with nano. Which key combination do you press and what do you type next?
APress Ctrl+F, then type "apple" and press Enter to search.
BPress Ctrl+W, then type "apple" and press Enter to search.
CPress Ctrl+S, then type "apple" and press Enter to search.
DPress Ctrl+G, then type "apple" and press Enter to search.
Attempts:
2 left
💡 Hint
Ctrl+W stands for 'Where is' in nano.
🧠 Conceptual
expert
1:30remaining
What is the effect of pressing Ctrl+X in nano when unsaved changes exist?
You have edited a file in nano but not saved it yet. You press Ctrl+X to exit. What happens next?
ANano asks if you want to save the changes before exiting.
BNano exits immediately and discards all changes.
CNano locks the file and prevents exiting until saved.
DNano saves the file automatically and then exits.
Attempts:
2 left
💡 Hint
Think about how editors protect your work.