Linux CLI - Disk and StorageYou want to automate partition creation on /dev/sdb using fdisk in a script. Which method is correct?AUse lsblk to create partitionsBRun fdisk interactively inside the script without input redirectionCUse a here-document to send fdisk commands: <code>fdisk /dev/sdb <<EOF n p 1 +20G w EOF</code>DUse fdisk -l to create partitionsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand scripting fdiskfdisk can accept commands via here-document to automate partition creation.Step 2: Evaluate other optionsInteractive fdisk needs manual input; lsblk and fdisk -l do not create partitions.Final Answer:Use a here-document to send fdisk commands -> Option CQuick Check:Here-documents automate fdisk commands [OK]Quick Trick: Automate fdisk with here-documents in scripts [OK]Common Mistakes:Trying to create partitions with lsblkUsing fdisk -l which only lists partitions
Master "Disk and Storage" in Linux CLI9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Linux CLI Quizzes Disk and Storage - du (disk usage by directory) - Quiz 15hard Disk and Storage - df (disk free space) - Quiz 12easy Networking Commands - nslookup and dig for DNS - Quiz 4medium Pipes and Redirection - Why pipes chain commands into workflows - Quiz 7medium Pipes and Redirection - /dev/null for discarding output - Quiz 10hard Process Management - Background processes (&) - Quiz 14medium Searching and Finding - find with -exec for actions - Quiz 13medium Searching and Finding - find by name, type, and size - Quiz 3easy Searching and Finding - find with -exec for actions - Quiz 15hard Searching and Finding - find by name, type, and size - Quiz 13medium