Activity 6 - A BAD File

Workshop Resources

Uma foto de Nuvi
I know I had a file secret-message.txt with one of my favorite quotes in it. "Do. Or do not. There is no try." Can you help me find it?

Searching for a pattern in a file?

grep (global search for regular expression and print the result) is a command used to search for text within files. There are different flags or options that can change how it is used.

The format is: grep [flag] “[pattern]” [filename].

-cTo get the number of files with the pattern.
-iTo make the search case-insensitive. “uNiX” is the same as “unix”
-nTo return matched lines and their line numbers.
-RSearch all files in current directory.
Uma foto de Nuvi
Let's practice this command to find my secret-message.txt!

Let’s try the following command:

grep -R "Do. Or do not. There is no try."

grep command

Why does the secret-message file look like that?

Uma foto de Nuvi
Remember that file we saw with the strange name? It was called We should go find it again and take a closer look at it. I think that the hackers left this!

find is a command used to search for a file with certain parameters within a directory or region of files. It can be used in multiple ways including:

Use the find command to search for the file within the current directory. Is there a command we can use to figure out what the current directory is?

find command