Dev Environment Flashcards

1
Q

What is the command line?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When working with the command line, what do we call files an folders?

A

directories

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the command, cd?

A

change directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is change directory for?

A

used to move from one directory (a.k.a., folder) to another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the command, pwd?

A

print working directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what does print working directory do?

A

used to print the name of the folder you’re currently in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the command, ls?

A

list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does the command list do?

A

used to list the contents of a directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is the command, mkdir?

A

make directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what does the command make directory do?

A

used to create a new directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is the command touch and what does it do?

A

used to create a new (empty) file with a given name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is the command rm?

A

remove

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what doe s the command rm do ?

A

used to remove a file or folder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is the command rmdir?

A

remove directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what does remove directory do ?

A

removes a directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is the command, mv?

A

move

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what does the command mv do?

A

it moves a file or directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

what is the command cp?

A

copy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

what is the command copy used for?

A

to copy a file or directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

what is the command line on windows called ?

A

Git Bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Anytime you’re working from the command line and need to double-check which folder you’re in, what command do you use?

A

pwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

if you’ve forgotten what a command does, how can you find out what it does inside the command line using windows?

A

help + command code

ex

help pwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

if you’ve forgotten what a command does, how can you find out what it does inside the command line using mac?

A

by using the man command. (manual)

ex

man pwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

what is the man command short for?

A

manual

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

when you use man to inquire about a command code on mac, which buttons do you press to scroll through the documentation?

A

up and down arrows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

how do you exit from manual when using a mac?

A

the ‘q’ button

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

other than the main function of a command code, what information will be documented when you use ‘help’ or ‘man
?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

what are flags in relation to command line codes?

A

they are additional codes that can be added to the original command code to modify its behavior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

are all flags single letter?

A

no some flags are multi-letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

what are single letter flags preceded by?

A

a single dash

ls - a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

what if you have two or more consecutive single letter flags added to a command code, what precedes it?

A

still a single dash

ls - al

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

what precedes a multi- letter flag on a command code?

A

double dashes –

merge – no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

when making a new directory how do you give it a name?

A

mkdir name

ex

mkdir test

will create a directory named ‘test’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

how do we create a new file inside of a specific folder?

A

touch foldername/filename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

what is a graphical interface?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

what is the graphical interface for mac?

A

finder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

what is the graphical interface for windows?

A

file explorer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

what is the cat command?

A

the cat command is short for conCATenate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

what is the cat command used for ?

A

to print out contents of a file to the command line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

how do we make nested folders?

A

mkdir -p foldername/foldername/foldername/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

what does the flag -p do when combined with mkdir?

A

it creates multiple folders at once, one inside of the other, if they don’t already exist

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

what does ~ refer to when in the command line?

A

it refers back to the users home folder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

what is tab completion?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

what are the three benefits to using tab completion?

A
  1. saves time
  2. keeps you from searching for a folder that isnt there
  3. keeps you from missing a folder due to wrong spelling.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

When you are in a folder, what will the up and down arrows allow you to do?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

what is the benefit in cycling up though commands using the up and down arrows?

A

it can save you time from having to retype every single command, every single time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

when creating names for files and directories, should you use spaces in the name?

A

No you should not, you should avoid them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

what should you use instead of spaces when naming files and directories ?

A

you should use dashes and underscores.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

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?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

how do we get back to the home folder of the current user in the command line?

A

cd ~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

what do you put after the cd command, when you want to change directories?

A

you put the path of the folder you want to go to?

cd ~ (home)
cd test (test folder)
cd cats (cats folder)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

what does the shortcut .. mean in the command line environment?

A

it is shortcut to the parent directory, so placing

cd ..
will take you back into the parent directory from the folder that you are in

53
Q

what do we need to make sure we are placing in between the command cd and the shortcut .. ?

A

we need to make sure we are placing a space?

54
Q

what is the shortcut . for?

A

the directory that you’re currently in

55
Q

can shortcuts be chained together?

A

yes they can.

for example

you can go cd ../.. and this will take you to the grandparent of the folder you are currently in

56
Q

when you chain shortcuts together, do you need to put a space in between them and the forward slash?

A

No, you do not

57
Q

what is a hidden file or folder?

A

A hidden file or folder is one that (unless you change your operating system’s preferences) won’t be viewable in your graphical interface

58
Q

can a hidden folder or file be seen when you use the ls command?

A

No you will not see them unless you use the appropriate flag on the ls command

59
Q

what are hidden files and folders commonly used for?

A

storing configuration data

60
Q

how do you make a file or folder hidden in Mac

A

you add a period . as the first character in the name

61
Q

how do you make a file or folder hidden in windows?

A

you add a period . as the first character in the name

and

use attrib +h “ file/folder name”

attrib +h “.hidden-file.txt”

62
Q

if you use windows and dont use the attrib +h on hidden file what happens?

A

it wont show up in the command line, but it will still show up in the graphical interface

63
Q

how can you see the hidden files in the command line even if its hidden?

A

add the flag -a to the ls command

ls -a

64
Q

what is the attrib +h “ file/folder name” do?

A

it makes a file/folder hidden not only in the command list but also in the graphical interface of windows as well

65
Q

when you use rm and rmdir to delete a folder, are the folders retrievable?

A

no they are not, once you delete these folders they are gone forever

66
Q

what should you always use with the command rm?

A

the flag -i

rm -i file name
rmdir -i folder name

67
Q

what does the flag -i do?

A

it will give you an interactive prompt that will tell you what you’re about to delete, and ask you to confirm that you really want to delete it.

68
Q

how to respond the interactive prompt that comes up when using the flag -i and the commands rm or rmdir to delete folders and files?

A

enter y - for yes

and n - for no

69
Q

whats the difference between mkdir and touch?

A

mkdir creates an empty folder

touch creates an empty file

70
Q

what is the only type of folders that rmdiv can remove?

A

empty folders

71
Q

why is rmdiv considered relatively safe in comparison to rm?

A

because rmdiv can only delete empty folders

72
Q

how do you delete folders that aren’t empty?

A

rm -rf nameoffolder

73
Q

what are we really doing when we “move” a file or directory within the same folder?

A

we are really just renaming it

74
Q

how do we “move”/rename a folder or file inside of the same folder?

A

(while inside of folder)

mv NameOfFolder/newNameOfFolder

75
Q

how do we move a folder or file into another folder?

A

mv nameoffile/folder nameofexistingfolder

76
Q

what is the difference between copying and moving a directory?

A

copying creates another file or directory while keeping the original, while moving just moves or renames the original

77
Q

Can you use cd to change directories to descendants or sibling or parent folders?

A

no only to children folders

78
Q

can you use mv to move files or folders into descendants, sibling or parent folders?

A

no only to children folders

79
Q

how to make a copy of a file?

A

cp folder/nameoffile folder/newnameoffile

80
Q

can you only copy files and folders to children folders?

A

no you can copy folders into children

81
Q

how do you make a copy of a folder as opposed to a file?

A

cp -r foldername newfoldername

82
Q

how do we open the command palette for VS Code on windows?

A

ctrl + shift + p

83
Q

Shortcut to create a new file in VS Code

A

ctrl + n

84
Q

Shortcut to save in VS Code

A

ctrl + s

85
Q

Shortcut to creating and closing tags in VS Code

A

tab button

86
Q

Shortcut to setting up boilerplate code in VS Code

A

!

87
Q

how do we open up the html page that we are working on inside of a browser to view it?

A

open the browser,
press ctrl + o
choose file from the box that pops up and open it
file will open in the browser window

88
Q

when working with a project with lots of files and folders what shorthand can we use to make a drop down window so we can search them quickly

A

ctrl + P

89
Q

What does it mean to initialize a project as a Git repository.

A

that we’re telling Git that we want to use its version control system in this folder. Once initialized, Git will be able to tell us things like which files it’s currently tracking (that is, which ones it pays attention to when it takes snapshots) and which ones have changed since a previous commit.

90
Q

how do we initiate a folder?

A

use command

git init

91
Q

do we need to touch any of the files in the invisible git folder that are added when you initialize a git repository?

A

No 99 percent of the time you will never need to touch these files or folders

92
Q

what does the command ‘git status’ do?

A

it gives us a rundown of which files from previous commits have changed, which files are new and not currently tracked, and which files have been moved or deleted.

93
Q

does git track all files in a repo?

A

no it only tracks what files you tell it to

94
Q

how do we tell the command line to track a file?

A

git add filename

95
Q

what does git command do?

A

it executes the staged changes for a file or folder and then takes a snapshot of them to save it so you can access it later if need be

96
Q

what does it mean when a branch is ‘clean’?

A

That means that there’s a 1-to-1 correspondence between Git’s most recent snapshot of the repository and its current state. Git knows about all the files in the repository (i.e., they’re all tracked), and its snapshot of each file is up to date.

97
Q

what is git commit?

A

used to take a snapshot of the repo at a point in time.

98
Q

what is git diff?

A

used to see what has changed in a repo since the last commit

99
Q

what is git reset?

A

used to reset your repository to a prior state.

100
Q

what is git checkout?

A

used to look at a prior state of the repository

101
Q

how do we add a comment when we use git commit?

A

git commit -m ‘comment’

102
Q

what is the definition of a branch?

A

a parallel version of a repository

103
Q

what is the nickname for a repository?

A

a repo

104
Q

what is version control in reference to Git?

A

refers to the process of managing changes to code

105
Q

what are the two distinct aspects of Git?

A
  1. taking snapshots of code.

2. creating brances of code

106
Q

what does initializing a project folder as a new repository mean?

A

All that means is that you tell Git that it should start tracking changes in that folder

107
Q

what is the difference between initialization and tracking and commiting?

A

when you initialize you are just saying “hey i want to use this tracking feature in this folder”

tracking is saying “when i do decide to take a snapshot of this folder, i only want you to focus on these files”

commiting is saying “ok take a picture of these things in this state so i can come back to it later if i need be”

108
Q

what does git add do?

A

it tells git which file inside of a initialized folder that it is to track

109
Q

what does git log do?

A

gives you a list of all the commits (or snapshots) of your code that have been made

110
Q

after you use git commit, what steps do you need to take when the interactive commit dialog opens up in the command terminal?

A
type :i
hit enter
type 'comment'
hit esc
type :q
hit enter
111
Q

what does git add -u do?

A

this stages all the changes of tracked files in a repo so you can commit it and save it all at once

112
Q

what does git diff file name do?

A

shows you specifically what code has been deleted and what code has been added on a file

113
Q

what does git diff do?

A

it shows you what specific code has been changed on all files inside of a specific repo

114
Q

how do you exit out of git command prompts?

A

:q

115
Q

when running git diff, there is a lot of information, what might you have to do to see it all?

A

use the down arrow to see it all

116
Q

how do we see the stats of what has been changed or added to a file or repo?

A

you use git diff –stat

117
Q

what should we keep in mind about git diff?

A

it will tell you the difference between the last commit and unstaged changes. Once changes are staged, they wont show up in git diff

118
Q

what does git checkout do?

A

get checkout allows you to look at earlier snapshots of your code and open them up in a text editor and play around with them without it affecting your current code

119
Q

how to switch to an earlier file using git checkout?

A
  • use git log in an initiated folder
  • copy the SHA number
  • git checkout (paste SHA)
  • run it
  • open text editor, it will be open in the text editor now
120
Q

how do we get back to master files after working on previous snapshots of our code?

A

git checkout master

121
Q

what is the HEAD in git?

A

its the commit that Git is currently pointing to

122
Q

so what does detached Head state mean?

A

it means that if you go back in time to look at an old screenshot of the code, you can experiment and delete and add things, but there is no way to save them so you can go back to them unless you create another branch

123
Q

alternative syntax to looking at earlier screenshots of Git?

A

git checkout head~ number

the number represents how many commits you want to go back

124
Q

When should you use git reset?

A

when you want to erase files that you haven’t shared with anyone else

125
Q

how do you use git reset?

A

git reset SHA number

126
Q

git reset erases what?

A

all files after the one that you point the head to.

so git reset HEAD~2

will erase the default head and the one before the default head and make the head the second one behind the original, which will still be there

127
Q

what does git add .

(with space and period) do?

A

it will stage any unstage changes in the current directory or its children

128
Q

when you use git reset, does it actually delete the files from the directory?

A

No it changes only the commit history. The files that you have used git reset on are now “unstaged”

129
Q

what do you do if you want to reset not only the commit history, but you also want to delete it from the files for real?

A

use the –hard flag

git reset –hard HEAD~ number

the number represents how far you want to go back from the current head