Dev Environment Flashcards
What is the command line?
The command line is a text-based environment where you can do things like create, move, copy, and delete files and folders, using different commands that are like mini-programs.
When working with the command line, what do we call files an folders?
directories
what is the command, cd?
change directory.
what is change directory for?
used to move from one directory (a.k.a., folder) to another
what is the command, pwd?
print working directory
what does print working directory do?
used to print the name of the folder you’re currently in
what is the command, ls?
list
what does the command list do?
used to list the contents of a directory
what is the command, mkdir?
make directory
what does the command make directory do?
used to create a new directory
what is the command touch and what does it do?
used to create a new (empty) file with a given name
what is the command rm?
remove
what doe s the command rm do ?
used to remove a file or folder
what is the command rmdir?
remove directory
what does remove directory do ?
removes a directory
what is the command, mv?
move
what does the command mv do?
it moves a file or directory
what is the command cp?
copy.
what is the command copy used for?
to copy a file or directory
what is the command line on windows called ?
Git Bash
Anytime you’re working from the command line and need to double-check which folder you’re in, what command do you use?
pwd
if you’ve forgotten what a command does, how can you find out what it does inside the command line using windows?
help + command code
ex
help pwd
if you’ve forgotten what a command does, how can you find out what it does inside the command line using mac?
by using the man command. (manual)
ex
man pwd
what is the man command short for?
manual
when you use man to inquire about a command code on mac, which buttons do you press to scroll through the documentation?
up and down arrows.
how do you exit from manual when using a mac?
the ‘q’ button
other than the main function of a command code, what information will be documented when you use ‘help’ or ‘man
?
it will also document possible flags that can be added to the command:
ex,
pwd: pwd [-L]
Print the name of the current working directory.
Options: -L print the value of $PWD if it names the current working
-L can be added to pwd to modify its behavior
what are flags in relation to command line codes?
they are additional codes that can be added to the original command code to modify its behavior
are all flags single letter?
no some flags are multi-letter
what are single letter flags preceded by?
a single dash
ls - a
what if you have two or more consecutive single letter flags added to a command code, what precedes it?
still a single dash
ls - al
what precedes a multi- letter flag on a command code?
double dashes –
merge – no
when making a new directory how do you give it a name?
mkdir name
ex
mkdir test
will create a directory named ‘test’
how do we create a new file inside of a specific folder?
touch foldername/filename
what is a graphical interface?
its an interface that users are shown pictures to go along with the text to display elements of a computer for instance, the home page on a smart phone.
what is the graphical interface for mac?
finder
what is the graphical interface for windows?
file explorer
what is the cat command?
the cat command is short for conCATenate
what is the cat command used for ?
to print out contents of a file to the command line
how do we make nested folders?
mkdir -p foldername/foldername/foldername/
what does the flag -p do when combined with mkdir?
it creates multiple folders at once, one inside of the other, if they don’t already exist
what does ~ refer to when in the command line?
it refers back to the users home folder
what is tab completion?
when in the command line, when looking for folders, that can sometimes be long and deeply nested, you can begin typing the file name and hit ‘tab’ the computer will search alphabetically and return any folder that matches, you can keep using tab completion until you get to the specific folder you are looking for
what are the three benefits to using tab completion?
- saves time
- keeps you from searching for a folder that isnt there
- keeps you from missing a folder due to wrong spelling.
When you are in a folder, what will the up and down arrows allow you to do?
It allows you to scroll through all the commands you entered. The farthest up one being the one you entered first and the farthest down one being your most recent.
what is the benefit in cycling up though commands using the up and down arrows?
it can save you time from having to retype every single command, every single time
when creating names for files and directories, should you use spaces in the name?
No you should not, you should avoid them.
what should you use instead of spaces when naming files and directories ?
you should use dashes and underscores.
If there is a file name or directory with a space in it, what would you need to do to find it or access it?
where there is a space you would need to add the backslash (escape character) before the space, then the space, and then whatever comes after it.
Any space will need to be preceded by a backslash. Not just the backslash itself. BACKSLASH + SPACE
how do we get back to the home folder of the current user in the command line?
cd ~
what do you put after the cd command, when you want to change directories?
you put the path of the folder you want to go to?
cd ~ (home) cd test (test folder) cd cats (cats folder)