Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to find the path of the 'ls' command using 'which'.
Linux CLI
which [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using commands like 'pwd' or 'cd' instead of 'ls' in the 'which' command.
Forgetting to put the command name after 'which'.
✗ Incorrect
The 'which' command shows the full path of the executable for the given command name. Here, 'ls' is the command we want to find.
2fill in blank
mediumComplete the code to find all locations of the 'bash' command using 'whereis'.
Linux CLI
whereis [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'whereis' with commands other than 'bash' when the question asks for 'bash'.
Confusing 'which' and 'whereis' commands.
✗ Incorrect
'whereis' locates the binary, source, and manual page files for a command. Here, we want to find all locations related to 'bash'.
3fill in blank
hardFix the error in the code to correctly find the path of the 'python3' command using 'which'.
Linux CLI
which [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Misspelling the command name as 'pythn3'.
Using 'python' or 'python2' when the question asks for 'python3'.
✗ Incorrect
The correct command name is 'python3'. Misspelling it like 'pythn3' will cause an error or no output.
4fill in blank
hardFill both blanks to find the path of 'grep' using 'which' and all related files using 'whereis'.
Linux CLI
which [1] && whereis [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different command names after 'which' and 'whereis'.
Using unrelated commands like 'ls' or 'cat' instead of 'grep'.
✗ Incorrect
Both commands need the same command name 'grep' to find its path and related files.
5fill in blank
hardFill all three blanks to create a script that finds the path of a command stored in variable 'cmd' using 'which', then finds all related files using 'whereis'.
Linux CLI
cmd='[1]' which [2] whereis [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using the variable 'cmd' in the 'which' and 'whereis' commands.
Assigning the wrong command name to 'cmd'.
✗ Incorrect
The variable 'cmd' is assigned the command name 'nano'. Then 'which $cmd' and 'whereis $cmd' use the variable 'cmd' to find paths and related files.