0
0
Linux CLIscripting~20 mins

Why file management is daily work in Linux CLI - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Daily File Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is file management important every day?
Which of the following best explains why file management is a daily task in Linux command line work?
AFiles constantly change and organizing them daily helps keep data accessible and secure.
BOnce files are created, they never need to be moved or deleted.
CFile management is only needed when installing new software.
DFiles automatically organize themselves without user intervention.
Attempts:
2 left
💡 Hint
Think about how files accumulate and change over time.
💻 Command Output
intermediate
2:00remaining
Output of listing files after daily cleanup
What is the output of this command sequence after daily file cleanup? Commands: mkdir testdir cd testdir touch file1 file2 file3 rm file2 ls
Linux CLI
mkdir testdir
cd testdir
touch file1 file2 file3
rm file2
ls
A
file2
file3
B
file1
file2
file3
C
file1
file3
D
file1
file2
Attempts:
2 left
💡 Hint
Check which file was removed before listing.
📝 Syntax
advanced
2:00remaining
Correct command to move files daily
Which command correctly moves all '.log' files from the current directory to a folder named 'logs' as part of daily file management?
Amv logs/ *.log
Bmv *.log logs/
Cmove *.log logs/
Dmv *.log to logs/
Attempts:
2 left
💡 Hint
The 'mv' command moves files; check the order of arguments.
🔧 Debug
advanced
2:00remaining
Why does this daily cleanup script fail?
This script is meant to delete all '.tmp' files daily but fails. Why? Script: rm *.tmp mkdir tmp_files mv *.tmp tmp_files/
AThe 'rm *.tmp' deletes all .tmp files before 'mv' can move them, so 'mv' fails.
B'mkdir tmp_files' should come after 'mv' command.
CThe 'rm' command syntax is incorrect; it needs a '-r' flag.
DThe script lacks a shebang line, so it won't run.
Attempts:
2 left
💡 Hint
Think about the order of deleting and moving files.
🚀 Application
expert
3:00remaining
Automate daily file archiving with a script
You want to create a daily script that archives all '.txt' files in the 'docs' folder into a zip file named with the current date (e.g., 2024-06-15.zip). Which script snippet correctly does this?
Azip "$(date +%F).zip" docs/*.txt
Bzip docs/*.txt "$(date +%F).zip"
Czip docs/ "$(date +%F).zip" *.txt
Dzip "$(date +%Y-%m-%d).zip" docs/*.txt
Attempts:
2 left
💡 Hint
Check the date format and argument order for the zip command.