In UNIX, _________ creates three subdirectories : ‘PIS’ and two subdirectories…
2016
In UNIX, _________ creates three subdirectories : ‘PIS’ and two subdirectories ‘progs’ and ‘data’ from just created subdirectory ‘PIS’.
- A.
mkdir PIS/progs PIS/data PIS
- B.
mkdir PIS progs data
- C.
mkdir PIS PIS/progs PIS/data
- D.
mkdir PIS/progs data
Attempted by 74 students.
Show answer & explanation
Correct answer: C
Correct command: mkdir PIS PIS/progs PIS/data
Why this works: The command creates the parent directory PIS first and then creates the two subdirectories inside it. When creating nested directories without using the -p option, the parent must exist at the time the nested directory is created.
Step 1: mkdir creates the directory PIS.
Step 2: mkdir creates PIS/progs, which becomes a subdirectory inside the already-created PIS.
Step 3: mkdir creates PIS/data, another subdirectory inside PIS.
Alternative: You can also use mkdir -p PIS/progs PIS/data to create parent directories as needed in one command without relying on argument order.