Week 1 - File and Text Manipulation Flashcards
What command do you use to view files?
cat
What is cat short for?
concatenate
How do you limit viewing large file output to 1 page at a time? What command? Can also be used to view a file
windows
more
What commands can you use to navigate ‘more’? W
Enter advance one line
Space advance one page
Q to exit
arrows
Using cat, how do you only see only the beginning or ending lines?
You use the parameters:
-Head #of lines
-Tail #of lines
In Linux, what command to view file contents?
cat
In Linux, how do you customize the output size of the view file contents command? Can also be used to view a file
less
LESS IS MORE LOL
In the less program in Bash, what are the different commands you use to navigate around the text?
q to exit
g to go to the beginning
G to go to the end
/word_search
How do you open a Notepad++ and create a file on the same command line? w
start Notepad++ filename.txt
What’s the command to open a program? w
start
What’s the command in Linux to create a file using a Linux popular text editor? This also allows you to create/modify a text file in the Shell
nano filename
What does the ^K mean? (the carrot)
to use Control + K
With what command do you see the actual command that gets executed in Powershell?
Get-Alias (command)
What are 2 ways to execute commands in PowerShell?
- use cmd.exe and \? for the equivalent of Get-Help for cmd.exe commands
- use the real PowerShell commands (relatable aliases) and Get-Help for more information
How do you configure the service to index file contents? Windows. 5 steps
- indexing options (search bar)
- Users
- Advanced
- File Types
- Select ‘Index Properties and File Types’
What’s the shortcut to “Find in Files” in Notepad++? (searches specific sectors depending on settings)
CTRL + Shift + F
What are 2 ways to search within files on Windows? What should be done first?
First: enable indexing options
- use Notepad++
- use PS command sls
What does sls stand for? w
select desk string
finds strings of characters or words
What’s a regular expression? w
a pattern-matching language used by sls to find text that matches
What is a “string”?
A way for the computer to represent text
strings of characters, words, etc
What powershell command lets you search for a word in a file?
sls
or
Select-String
don’t have to be in the same directory as it
What does the wildcard asterisk mean?
selecting all
How do you use regular expressions and a command to search for a word in a pattern (entire computer directories)? Provide example
Select-String lemonade *.txt
How do you quickly change directories to go back to the desktop?
cd ..
What command do you use to search and display a list of patterns within a >specific< directory like D:\Program Files
ls ‘D:\Program Files' -Recurse -Filter *Adobe
Recurse to search specific directory
Filter filters results for file names that match
What command does the -Filter parameter combine with when listing items with patterns and what does it do?
Combines with ls to filter results matching specific patterns
What is a similar command to Select-String in Linux?
grep
On Linux, what does grep let you search? 4
search for words within files that match a pattern
if a certain file exists in a directory
if a word was in a file
search through multiple files
What’s an example of a search a word within a text file command on Linux?
grep apple fruit.txt
do you have to be in the same directory to search the targeted file using grep? Linux
yes
How do you search for a word in multiple files in Linux?
Use the asterisk and grep
grep notes *_notes.txt
like if the file name was biology_notes.txt
math_notes.txt
What is echo an alias for?
Write-Output
What does the echo command do?
Let’s us write the output we want to see (the alias is Write-Output)
What can every Windows process and PowerShell command do with input?
produce output using I/O streams or input output streams
What are the 3 types of I/O streams?
- standard input stdin
- standard output stdout
- standard error stderr