Command Line Flashcards
print work directory
pwd
shows what directory user is currently in.
$ means
type what follows into the terminal and hit return
list complete (unhidden) contents of current directory
ls
create a new folder in current directory
mkdir folderName
synonym for folder
directory
open a different directory
cd folderName
shortcut for home directory
~
abbreviation for the parent folder
..
to auto-complete in command line applications
press tab
agnostic terms for command line applications
“command line interface” or “the shell”
create or update a file on a Mac
touch
equivalent to “touch” for Linux or Windows
type NUL > filename.filetype
or, for advanced stuff but without the error message:
fsutil file createnew filename.filetype filesize
what does BASH stand for?
Bourne Again SHell (Bourne was the name of one of the original programs using the terminal)… means the same thing as CLI
copy a file
cp filename.fileytpe newfilename.filetype
delete a file
rm filename.filetype
delete a folder
rmdir folderName
does not work on Mac if folder has contents
delete a folder on a Mac
rm -r
- means “option” and r stands for “recursive.” this will, on a Mac, delete a folder and all its contents
why is rm different than just deleting something on the GUI?
rm removes a file or folder and its contents permanently. It does not get sent to a trash folder. It cannot be recovered.
what does rm -rf/ do?
it erases an entire hard drive. (rm = remove, r = recursive, f = force)
see the last 500 or so things typed inside the terminal on a Mac or GitBash
history
in PowerShell, only shows history since application was last opened
show contents of a file on Mac or in GitBash
less filename.filetype
(spacebar to advance through a long file /
q to close ensuing window)
show contents of a file in PowerShell
Get-Content (filepath)filename.filetype
shows up on command line rather than opening new terminal window
move a file
mv filename.filetype path
rename a file
mv filename.filetype newfilename.filetype
list all, including hidden files (and folders)
ls -a (a stands for “all”)
create a hidden file
touch .filename.filetype
abbreviation for current directory
.
what does a space mean to the terminal?
it means two separate entities
how do I enter a single entity into the terminal with a space in its title?
‘single entity’ (using a string)
how do I prevent the terminal from reading a character or space as a command rather than just a character?
\ escapes a character (or in other words, causes the character itself to be represented, rather than its function in the context of the command line).