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
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.
26
how do you exit from manual when using a mac?
the 'q' button
27
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
28
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
29
are all flags single letter?
no some flags are multi-letter
30
what are single letter flags preceded by?
a single dash ls - a
31
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
32
what precedes a multi- letter flag on a command code?
double dashes -- merge -- no
33
when making a new directory how do you give it a name?
mkdir name ex mkdir test will create a directory named 'test'
34
how do we create a new file inside of a specific folder?
touch foldername/filename
35
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.
36
what is the graphical interface for mac?
finder
37
what is the graphical interface for windows?
file explorer
38
what is the cat command?
the cat command is short for conCATenate
39
what is the cat command used for ?
to print out contents of a file to the command line
40
how do we make nested folders?
mkdir -p foldername/foldername/foldername/
41
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
42
what does ~ refer to when in the command line?
it refers back to the users home folder
43
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
44
what are the three benefits to using tab completion?
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.
45
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.
46
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
47
when creating names for files and directories, should you use spaces in the name?
No you should not, you should avoid them.
48
what should you use instead of spaces when naming files and directories ?
you should use dashes and underscores.
49
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
50
how do we get back to the home folder of the current user in the command line?
cd ~
51
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) ```
52
what does the shortcut .. mean in the command line environment?
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
what do we need to make sure we are placing in between the command cd and the shortcut .. ?
we need to make sure we are placing a space?
54
what is the shortcut . for?
the directory that you're currently in
55
can shortcuts be chained together?
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
when you chain shortcuts together, do you need to put a space in between them and the forward slash?
No, you do not
57
what is a hidden file or folder?
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
can a hidden folder or file be seen when you use the ls command?
No you will not see them unless you use the appropriate flag on the ls command
59
what are hidden files and folders commonly used for?
storing configuration data
60
how do you make a file or folder hidden in Mac
you add a period . as the first character in the name
61
how do you make a file or folder hidden in windows?
you add a period . as the first character in the name and use attrib +h " file/folder name" attrib +h ".hidden-file.txt"
62
if you use windows and dont use the attrib +h on hidden file what happens?
it wont show up in the command line, but it will still show up in the graphical interface
63
how can you see the hidden files in the command line even if its hidden?
add the flag -a to the ls command ls -a
64
what is the attrib +h " file/folder name" do?
it makes a file/folder hidden not only in the command list but also in the graphical interface of windows as well
65
when you use rm and rmdir to delete a folder, are the folders retrievable?
no they are not, once you delete these folders they are gone forever
66
what should you always use with the command rm?
the flag -i rm -i file name rmdir -i folder name
67
what does the flag -i do?
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
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?
enter y - for yes | and n - for no
69
whats the difference between mkdir and touch?
mkdir creates an empty folder | touch creates an empty file
70
what is the only type of folders that rmdiv can remove?
empty folders
71
why is rmdiv considered relatively safe in comparison to rm?
because rmdiv can only delete empty folders
72
how do you delete folders that aren't empty?
rm -rf nameoffolder
73
what are we really doing when we "move" a file or directory within the same folder?
we are really just renaming it
74
how do we "move"/rename a folder or file inside of the same folder?
(while inside of folder) mv NameOfFolder/newNameOfFolder
75
how do we move a folder or file into another folder?
mv nameoffile/folder nameofexistingfolder
76
what is the difference between copying and moving a directory?
copying creates another file or directory while keeping the original, while moving just moves or renames the original
77
Can you use cd to change directories to descendants or sibling or parent folders?
no only to children folders
78
can you use mv to move files or folders into descendants, sibling or parent folders?
no only to children folders
79
how to make a copy of a file?
cp folder/nameoffile folder/newnameoffile
80
can you only copy files and folders to children folders?
no you can copy folders into children
81
how do you make a copy of a folder as opposed to a file?
cp -r foldername newfoldername
82
how do we open the command palette for VS Code on windows?
ctrl + shift + p
83
Shortcut to create a new file in VS Code
ctrl + n
84
Shortcut to save in VS Code
ctrl + s
85
Shortcut to creating and closing tags in VS Code
tab button
86
Shortcut to setting up boilerplate code in VS Code
!
87
how do we open up the html page that we are working on inside of a browser to view it?
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
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
ctrl + P
89
What does it mean to initialize a project as a Git repository.
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
how do we initiate a folder?
use command git init
91
do we need to touch any of the files in the invisible git folder that are added when you initialize a git repository?
No 99 percent of the time you will never need to touch these files or folders
92
what does the command 'git status' do?
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
does git track all files in a repo?
no it only tracks what files you tell it to
94
how do we tell the command line to track a file?
git add filename
95
what does git command do?
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
what does it mean when a branch is 'clean'?
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
what is git commit?
used to take a snapshot of the repo at a point in time.
98
what is git diff?
used to see what has changed in a repo since the last commit
99
what is git reset?
used to reset your repository to a prior state.
100
what is git checkout?
used to look at a prior state of the repository
101
how do we add a comment when we use git commit?
git commit -m 'comment'
102
what is the definition of a branch?
a parallel version of a repository
103
what is the nickname for a repository?
a repo
104
what is version control in reference to Git?
refers to the process of managing changes to code
105
what are the two distinct aspects of Git?
1. taking snapshots of code. | 2. creating brances of code
106
what does `initializing a project folder as a new repository` mean?
All that means is that you tell Git that it should start tracking changes in that folder
107
what is the difference between initialization and tracking and commiting?
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
what does git add do?
it tells git which file inside of a initialized folder that it is to track
109
what does git log do?
gives you a list of all the commits (or snapshots) of your code that have been made
110
after you use git commit, what steps do you need to take when the interactive commit dialog opens up in the command terminal?
``` type :i hit enter type 'comment' hit esc type :q hit enter ```
111
what does git add -u do?
this stages all the changes of tracked files in a repo so you can commit it and save it all at once
112
what does git diff file name do?
shows you specifically what code has been deleted and what code has been added on a file
113
what does git diff do?
it shows you what specific code has been changed on all files inside of a specific repo
114
how do you exit out of git command prompts?
:q
115
when running git diff, there is a lot of information, what might you have to do to see it all?
use the down arrow to see it all
116
how do we see the stats of what has been changed or added to a file or repo?
you use git diff --stat
117
what should we keep in mind about git diff?
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
what does git checkout do?
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
how to switch to an earlier file using git checkout?
- 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
how do we get back to master files after working on previous snapshots of our code?
git checkout master
121
what is the HEAD in git?
its the commit that Git is currently pointing to
122
so what does detached Head state mean?
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
alternative syntax to looking at earlier screenshots of Git?
git checkout head~ number the number represents how many commits you want to go back
124
When should you use git reset?
when you want to erase files that you haven't shared with anyone else
125
how do you use git reset?
git reset SHA number
126
git reset erases what?
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
what does git add . | (with space and period) do?
it will stage any unstage changes in the current directory or its children
128
when you use git reset, does it actually delete the files from the directory?
No it changes only the commit history. The files that you have used git reset on are now "unstaged"
129
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?
use the --hard flag git reset --hard HEAD~ number the number represents how far you want to go back from the current head