Powershell commands Flashcards
ls
list directories
get-help ls
brief summary of command’s parameters
Get-help ls -Full
description of parameters and how to use the command
Ls -force [drive name c:\]
show hidden and system files and directories
pwd
print working directory (shows which directory you’re working in)
cd
change directory
cd ..
go back up one level from the directory you are in
cd ~
moves me back to the home or main directory
mkdir
make directory (folder)
to create spaces in a directory name put it in single quotes ‘my cool folder’ or with back tick marks my cool
folder
` - back tick mark
escape characters which tell the shell to treat the next item literally
history or ctrl+r
displays previous commands used and then I can navigate the commands with up and down arrows and then repeat or change the command without typing all of it
clear
clears the output on the screen if its looking a little cluttered
cp
copy file
*
anything
-recurse
lists the contents of the directory
-verbose
gives more detailed information in a command
mv
renames files AND
moves files between directories
rm
removes files and directories
rm -force
remove system or other restricted files
rm -recurse
removes folder and contents and other directories inside it
cat
short for concatenate
gets contents of a file and outputs the contents to the screen
more
gets the contents of the file (especially a larger one) and displays it to the terminal window until it fills it.
Separate command in powershell and has its own commands
enter button
advances the content on the screen 1 line at a time after “more” command has been used
Space button
advances file content by the size of the page after the more command
q key
quit out of the “more” command and return to powershell
cat -head
displays the first few lines of a file
cat -tail
displays the last few lines of a file
start notepad++ [filename]
opens a file directly in notepad for viewing or editing
get -alias
displays the alias of a command
For instance:
“get -alias ls” displays actual command name get-childitem
get -childitem
same as ls
/?
get help
select-string
returns the “string” of characters or items listed
can be used with the *
-filter
select specific file content(s) to search for or display
echo
alias for write-output
write-output
Sends the output of a command to the next command for execution. Or displays the output to the screen if it’s the last command to be executed.
>
re-director operator for standard output
i.e. instead of the screen another location like a file
$null
redirects unwanted output to the “black hole of nothing”