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
What does g do in the less shell in Bash?
moves to the beginning of a file
what does capitol G do in the ‘less’ shell in Bash?
moves to the end of a file
what does the command /word_search do in Bash, in the less page?
allows you to search for a word or phrase
what can you do if you type /learning in the less page?
you will be searching the text document for the word you want to search for, in this case, learning.
what does q do in the less shell in Bash?
lets you quit out of less and go back to the shell
What does head do in Linux Shell with a text document?
shows the first 10 lines of a file by default
what would the command
head fruit.txt
print?
the first 10 lines of the fruit.txt file
how do you view the last 10 lines of a file in Bash?
tail
what will the command
tail fruit.txt
do?
print the last 10 lines of the fruit.txt file
what is one basic program you can use to edit text files with the windows gui?
notepad
what is a good text program to use when making configurations to scripts, configuration files, or other complex text files?
Notepad++
what is Notepad++?
an open source text editor with support for different file types
What text editor can open multiple files and tabs?
Notepad++
what text editor does syntax highlighting for known file types? and has advanced text editing features
Notepad++
what is syntax highlighting in a text editor like Notepad++?
display text in different colors,
different fonts to help you categorize things
what did I download that i think is a programming program?
notepad++
what editor can I use to edit any file?
Notepad++
how can I edit a file from the cli?
no good default editor from PowerShell terminal, but we can launch notepad++ from the CLI and modify that way.
what would the command in PowerShell
start notepad++ hello
do?
open notepad++,
ask if you want to create this file with this name, or see if you want to edit a file with this name.
what is one text editor that can be found on nearly any distribution of linux?
nano
how do you edit a file in nano?
type
nano filename
what does Caret mean in the nano text editor? ^
use ctrl plus whatever letter.
what does get help do in nano?
opens a help page
what does ^X do in nano?
it lets you go back to the bash shell, brings you to a page where you can save your work and name it
what text editor thinks of itself as almost being an operating system?
emacs
what command on PowerShell, real PowerShell command, is used to see more information about commands?
Get-Help
what PowerShell command lets us look and see what the actual PowerShell command is that gets executed
Get-Alias
what is ls the alias for?
Get-ChildItem
what does Get-ChildItem do?
gets or lists the children which are the files and subdirectories of the given item
what happens if you run
Get-ChildItem C:\
this is the same output as ls C:\
what commands are very long and descriptive?
PowerShell commands
what is a great way to work more quickly in PowerShell?
aliases
What are the three different types of executable commands you can use in PowerShell?
real PowerShell commands, relatable alias names, cmd.exe
what are commands from the old MSDOS days of Windows? Can still be run due to backwards compatibility
cmd.exe
What are the alias and cmd.exe versions of Get-ChildItem?
ls and dir
what parameter do you use to Get-Help with cmd.exe commands? PowerShell
/?
What is used for PowerShell commands to get help with them?
Get-Help
What is used to get help with other commands like dir?
/?
how would I use /? to get help with a command like dir?
ex:
dir /?
what happens if you use ls /?
it will return nothing. the PowerShell command ls is alias of doesn’t understand that parameter.
what are we using in this course? command-wise
aliases and PowerShell commands