Module 1 Day 5, Windows: display file contents, windows powershell Flashcards
how to open a file in windows gui?
double click on it
what do text files default to open in Windows?
Notepad
how do you change the default application that opens files in Windows?
right click, properties, open with, select what you want it to open with instead.
what will most files we deal with in this course be?
text and configuration files
how to view files with PowerShell? What command?
cat
what does cat stand for?
concatenate
what command will dump the contents of the file, ‘document.txt’ into our shell, in PowerShell? It will keep writing the content until the whole file is displayed.
cat .\document.txt
how do you view the contents of a file one page at a time PowerShell? what command do you use?
more
what will the more command do?
get the contents of the file, and pause once it fills terminal window.
What command for reading text in the cli PowerShell launches you into a separate program from the shell/shelf?
More command.
what keys do you use to operate the more program?
enter, space, q,
what does the Enter key do in the More program in PowerShell?
advances the file by one line. Move slowly through the file.
what does space do in the More program in PowerShell?
advances the file by one page
what is the size of a ‘page’ in the More program?
It depends on the size of your terminal window
what does the q key do in the More program in PowerShell?
allows you to quit out of More and go back to the Shell
what command parameter do you use in PowerShell to read just the first few lines of a file?
-Head
What is the Head of the file?
Just the first bit of it, so you can get a glimpse of what the document is.
How would you use the -heads parameter to read the fruits.txt file?
cat fruits.txt -Head (number)
What will the -Head 10 parameter make the cat command do?
read the first 10 lines of the file.
What command shows us the last lines in a file?
-Tail
how do you read a simple file in Bash?
use the cat command to view a document
how would you cat document.txt in Bash? Simple, print the whole thing
cat document.txt
what command lets us view more manageable portions of a file in Bash than just cat?
less
how can I use less to read document.txt?
less document.txt
what does the output of less in Bash look like?
you are launched into an interactive shell, and can see similar to more in Windows.
what command is an alternative to less, but has been dying in favor of less?
more
what are the common keys to use to interact with the less shell?
up,
down,
page up,
page down,
g,
G,
/word_search,
q