Module 1 Day 6: Windows searching within files, Supplemental reading for Windows PowerShell Flashcards

1
Q

in windows, how do you search for a word in a document? what hotekey

A

ctrl-f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how do you check if a word exists in multiple files in Windows? GUI

A

Windows Search Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What indexes files on your computer by looking through them on a schedule.

A

Windows Search Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What service on Windows compiles a list of names and properties of the file into a database?

A

Windows Search Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what service that compiles names and properties into a database is usually disabled on Windows Servers?

A

Windows Search Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Windows Search Service usually enabled on for files in the home directory, but not the entire hard drive?

A

Windows 8 and Windows 10 desktop computers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What can you find files based on in Windows Search Service?

A

name, path, last time modified, size, other details

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What can’t you do with Search service by default? windows

A

search for words inside of files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what can you configure Windows Search Service to do?

A

search file contents and their properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why is it that Windows Search Service is not configured to search file contents and properties by default?

A

it increases the time it takes for the indexer to work.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the Search Service do ahead of time?

A

runs processes, finds the information for you, and then you just have to retrieve it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you configure Search Service to search file contents and properties?

A

start menu, type: indexing, click indexing options, Select Users, click Advanced, select file types tab, select index properties and file contents, click OK, close out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you configure the Windows Search Service? Where are the settings for it?

A

Indexing options in the control panel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When you configure Windows Search Service, will all search terms you want access to be available and all files be indexed the way you want immediately?

A

no, it takes some time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what will Windows do as soon as you have finished configuring Search Service?

A

it will begin rebuilding its index based on your new settings, could be a while or fast, depending on how large your files are.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what can you use in your home directory, GUI, to find files with specific words in them?

A

Windows File Explorer in home directory. Go to your home directory, and type the term you want to search in your search bar.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how can you tell if indexing is complete?

A

Indexing Options will show you.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what is another service you can use to find files with words in them?

A

Notepad++

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How do your search files for words in notepad++?

A

in Notepad++, press CTRL+SHIFT+F to open the Find in files dialog. Find What: word. Directory: Users. Search.
This is very time-consuming unless you get more specific.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In Notepad++, when searching,
What is something you can search the name of?
where can you limit your search to?
what can you use a set of to find files?
what can you set notepad++ to replace in files?

A

specify what files you want to search,
limit search to a directory,
set of file extensions,
replace words with other words, editing the file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

how can you search files for words from the command line PowerShell? what command do you use?

A

sls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what does sls do? PowerShell

A

find words or other strings of characters and files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what does sls stand for? PowerShell

A

Select-String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

what are strings?

A

a way for the computer to represent text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
what command searches for text that matches a pattern you provide? PowerShell
sls
25
what sorts of patterns could you provide to the sls command PowerShell?
word, part of a word, phrase, more complex patterns that are described using a pattern matching language called Regular Expressions
26
What are Regular Expressions?
A sequence of characters that specifies a match pattern in text.
27
what is the format for the sls command to find words in files? to tell you the file and line number in the file where it was found?
Select-String word document
28
how would you use wildcard in PowerShell to find multiple files with a keyword? text files with the word in it.
Select-String 'word' *.txt
29
what command parameter on PowerShell with sls can you use to just look up things in a directory?
-Filter
30
How would I use the command parameter -Filter? look for .exe in C:\Program Files
ls 'C:\Program Files\' -Recurse -Filter *.exe
31
what will the -Filter parameter filter?
the results for file names that match a pattern
32
what does the asterisk mean?
match anything
33
What is .exe?
the file extension for executable files in Windows
34
how can we search for words in files that match a certain pattern? command in Linux
grep
35
how to find out if a file is in a directory or a word is in a file? Linux
grep
36
what would the command: grep cow farm_animals.txt do?
search for the word cow in the file farm_animals.txt, and pull it up with it highlighted in red. It shows you if it found the word in the file.
37
how can you use grep to search multiple files? search for the word cow in any files that end in _animals.txt
grep cow *_animals.txt
38
what will grep cow *_animals.txt show?
in all _animals.txt files, it will show if the word cow is in the document.
39
what is echo an alias for?
Write-Output
40
on a surface level, what does the echo command do?
prints out our keyboard input to the screen
41
what does I/O streams mean?
input/output streams
42
how many streams does each process in Windows have?
three
43
what is stdin?
standard in
44
What is stdout?
standard out
45
what is stderr?
standard error
46
how do you provide input to a process?
add things to the standard instream, which flows into the process.
47
what creates output?
the process, when it adds data to the standard out stream.
48
what stream does the data you input into the CLI go to?
the standard in stream for the process you interact with
49
how does a process communicate with you?
puts data into the standard out stream
50
what does the CLI write?
data from the standard out stream
51
what symbol do you use to put the standard output information in a file instead of putting it in the PowerShell CLI?
>, the greater than symbol
52
what do we call the >?
a redirect, operator, that lets us change where we want our standard output to go. I can send to file, instead of the screen, for example.
53
what should I think of data streams as?
actual streams of information.
54
what will the > do if you direct echo to write to a file?
if the file exists, it will overwrite it for us. Otherwise, it will make a new file.
55
what do you do if you don't want > to overwrite an existing file?
use the command """>>,"" which means -Append
56
how would I make a file, using the echo and > commands called dog.txt which says woof?
echo woof > dog.txt
57
how would I add to a document called dog.txt, and make it say an additional woof?
echo woof >> dog.txt
58
what if you want to send the output of one command to the output of another command?
the pipe operator
59
how would I lift the words that just contain the string st from a file called words.txt
``` cat words.txt | Select-String st ```
60
Take all the words from the file called words.txt, starting with st, and put them into a file called st_word.txt. Hint: display the contents of a file called words.txt. Next, you want to take all the words from that file that start with st, and put that into a file called st_word.txt
``` cat words.txt | Select-String st > st_word.txt ```
61
if you don't want to see errors, how can you redirect them in a different output stream?
standard error.
62
what does rm secure_file 2> errors.txt do?
makes you a file called errors.txt, and then you can see the error message from before.
63
what does the 2 mean in rm secure_file 2> errors.txt?
all of the output streams are numbered, and this is the number for the standard error output. one is for standard out, instead.
64
what does 2> mean?
we are telling PowerShell to redirect the standard error stream to the file instead of out.
65
how can you filter error messages? what command can you use?
$null
66
what is $null?
nothing. a redirection black hole.
67
how do you redirect error message for rm secure_file to $null?
rm secure_file 2> $null
68
do this later: PowerShell
Get-help about_redirection
69
what are the three linux streams?
stdin stdout stderr
70
what does echo woof > dog.txt do in linux bash?
make a file that says woof called dog.txt
71
what does the >> operator do in Linux?
appends to a file instead of overwriting
72
what is format for append or greater than?
echo input >(>) filename.txt
73
in redirector?
<
74
how to use the standard in redirect operator to get input from files?
cat < file_input.txt
75
what does cat < file_input.txt do in linux?
the same thing as cat file_input.txt, only we aren't using keyboard input, we are using the file as standard in.
76
how do you redirect just the error messages of some output in linux? make a document called error_output.txt. to get the error, list directory /dir/fake_dir.
ls /dir/fake_dir 2> error_output.txt
77
what is the Linux nullifying black hole?
the /dev/null file
78
how to see the standard messages only, filtering out the errors in a file to null, and look at var/log/syslog? in
less /var/log/syslog 2> /dev/null
79
how can you see which sub-directories in the /etc directory contain the word Bluetooth? use the pipe redirected to take the output of ls -la /etc and send it to the grep command.
ls -la /etc | grep bluetooth
80
what are used to help you do advanced pattern-based selection?
Regular expressions
81
https://learn.microsoft.com/en-us/shows/getting-started-with-microsoft-powershell/
getting started with Microsoft PowerShell
82
PowerShell for every system
https://github.com/PowerShell/PowerShell
83
What does unbalanced sugar do?
Kills me
84
what is /r[aeiou]+/g an example of?
a regular expression sequence that will get you all characters matching the pattern, lowercase r followed by one or more lower-case vowels.
85
what is the shortening of regular expression?
regex
86
what is the grep command derived from?
g/re/p: global search for regular expression and Print matching lines.