Question 3.22: You want to find a file that you know is on the system somew......

You want to find a file that you know is on the system somewhere.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

Use the Linux find command.

Discussion

Starting with a directory specified in the command, the find command will search, and if it finds the file, display its location. For example:

$ find /home/pi -name gemgem.py
/home/pi/python_games/gemgem.py

You can start the search higher up the tree, even at the root of the whole filesystem (/). This will make the search take a lot longer, and will also produce error messages. You can redirect these error messages by adding 2>/dev/null to the end of the line.

To search for the file throughout the entire filesystem, use the following command:

$ find / -name gemgem.py 2>/dev/null
/home/pi/python_games/gemgem.py

You can also use wildcards with find as follows:

$ find /home/pi -name match*
/home/pi/python_games/match4.wav
/home/pi/python_games/match2.wav
/home/pi/python_games/match1.wav
/home/pi/python_games/match3.wav

/home/pi/python_games/match0.wav
/home/pi/python_games/match5.wav

See Also

The find command has a number of other advanced features for searching. To see the full manpage documentation for find, use this command:

$ man find

Related Answered Questions

Question: 3.34

Verified Answer:

Use the Linux df command: $ df -h Filesystem   ...
Question: 3.33

Verified Answer:

Use the Linux date command. The date and time form...
Question: 3.32

Verified Answer:

Edit the file ~/.bashrc using nano (Recipe 3.6), a...
Question: 3.31

Verified Answer:

Run the program or command in the background using...
Question: 3.30

Verified Answer:

Redirect the output to /dev/null using >. For e...
Question: 3.24

Verified Answer:

Use the Task Manager utility, which you’ll find on...
Question: 3.29

Verified Answer:

Use the pipe command, which is the bar symbol (|) ...
Question: 3.27

Verified Answer:

Use the > command to redirect output that would...
Question: 3.28

Verified Answer:

Use the cat command to concatenate a number of fil...
Question: 3.26

Verified Answer:

Use the lsusb command. This will list all the devi...