0
0
Linux CLIscripting~10 mins

which and whereis for commands in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Aecho
Bpwd
Ccd
Dls
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'.
2fill in blank
medium

Complete 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'
Acat
Bls
Cbash
Dgrep
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'whereis' with commands other than 'bash' when the question asks for 'bash'.
Confusing 'which' and 'whereis' commands.
3fill in blank
hard

Fix 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'
Apython3
Bpython
Cpythn3
Dpython2
Attempts:
3 left
💡 Hint
Common Mistakes
Misspelling the command name as 'pythn3'.
Using 'python' or 'python2' when the question asks for 'python3'.
4fill in blank
hard

Fill 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'
Agrep
Bls
Ccat
Dawk
Attempts:
3 left
💡 Hint
Common Mistakes
Using different command names after 'which' and 'whereis'.
Using unrelated commands like 'ls' or 'cat' instead of 'grep'.
5fill in blank
hard

Fill 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'
Anano
B$cmd
Dls
Attempts:
3 left
💡 Hint
Common Mistakes
Not using the variable 'cmd' in the 'which' and 'whereis' commands.
Assigning the wrong command name to 'cmd'.