0
0
Linux CLIscripting~5 mins

which and whereis for commands in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the which command do in Linux?
The which command shows the full path of the executable file that would run if you typed a command. It helps find where a command is located in your system's PATH.
Click to reveal answer
intermediate
What is the difference between which and whereis commands?
which shows the path of the executable that runs for a command. whereis shows locations of the binary, source, and manual files related to the command.
Click to reveal answer
beginner
How do you use which to find the path of the python3 command?
Type which python3 in the terminal. It will print the full path of the python3 executable if it is found in your PATH.
Click to reveal answer
intermediate
What kind of files does whereis locate for a command?
whereis locates the binary executable, source code files, and manual (man) pages related to a command.
Click to reveal answer
beginner
If which returns no output for a command, what does that mean?
It means the command is not found in any directory listed in your PATH environment variable, so it likely isn't installed or accessible from your current shell.
Click to reveal answer
What does the which command show?
AAll files related to a command including source and man pages
BThe last time the command was used
CThe size of the command's executable
DThe full path of the executable that runs for a command
Which command shows the binary, source, and manual files for a command?
Awhich
Bfind
Cwhereis
Dlocate
If you want to find where the ls command executable is, which command do you use?
Awhich ls
Bfind ls
Cwhereis ls
Dlocate ls
What does it mean if which returns no output for a command?
AThe command is broken
BThe command is not in your PATH
CThe command is hidden
DThe command is running
Which command would you use to find the manual page location for grep?
Awhereis grep
Bwhich grep
Cman grep
Dlocate grep
Explain how which and whereis commands help you find information about commands in Linux.
Think about what each command tells you about a program.
You got /4 concepts.
    Describe a situation where you would use which and another where you would use whereis.
    Consider simple command use vs deeper info needs.
    You got /4 concepts.