Command Line Flashcards

1
Q

What is a CLI?

A

Command line interface

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

What is a GUI?

A

graphical user interface

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

man

A

to get the manual on a command. Man cat for example.

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

cat

A

print the contents of a file or concatenate multiple files.

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

ls

A

display a list of contents of a directory.

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

pwd

A

print working directory

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

echo

A

can use echo to print messages and then create new txt files with that message

echo hello world > hello.txt

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

touch

A

touch changes file timestamps. creates new files

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

mkdir

A

make directory mkdir parent

mkdir -p parent/child/grandchild

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

mv

A

move command, used to rename directorys or move.

mv pokiemans to pokemon

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

rm

A

remove command

rm lol.txt

rm -r directoryname to delete all of its contents

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

cp

A

copy

cp nameoffile newnameofcopy

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

history

A

shows history of all recent command line commands to your terminal.

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

what are 3 features of a great programmer.

A

laziness, hubris, impatience

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

What is Node.js?

A

Node.js is a program that allows JavaScript to be run outside of a web browser. It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

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

What can Node.js be used for?

A

It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

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

What is a REPL?

A

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user;

console or gitbash

18
Q

When was Node.js created?

A

may 27 2009 by ryan dhal

19
Q

What back end languages have you heard of?

A

Java, ruby, python

20
Q

What is the process object in a Node.js program?

A

object that contains meta information, and control over the current node js process.

21
Q

How do you access the process object in a Node.js program?

A

just grab it, it always exists

22
Q

What is the data type of process.argv in Node.js?

A

its an array of strings

23
Q

What is a JavaScript module?

A

in JavaScript, a “module” is a single .js file

24
Q

What values are passed into a Node.js module’s local scope?

A

exports, __filname, __dirname, require, module

25
Q

Give two examples of truly global variables in a Node.js program.

A

process, console

26
Q

What is the purpose of module.exports in a Node.js module?

A

to export a desired item you attach to the exports property of the module.object

27
Q

How do you import functionality into a Node.js module from another Node.js module?

A
module.exports = add
const add = require('./add');
28
Q

what is the javascript event loop?

A

function calls stack on top of the stack. Returns pop off stack.

event loop has to wait for the stack to be clear to push the callback into the stack from the task queue.

29
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A
30
Q

What is a directory?

A
31
Q

What is a relative file path?

A

its a path to a file from where you are

32
Q

what is an absolute file path?

A

the root of the file system, just a slash.

33
Q

What module does Node.js include for manipulating the file system?

A

the fs module.

34
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile

35
Q

Are file operations using the fs module synchronous or asynchronous?

A

asynchronous and synchronous. fs.writeFileSync try catch if for synchronous code.

36
Q

What is NPM?

A

npm is a package manager for the JavaScript programming language maintained by npm. made up of 3 things: website, registry or the cli.

37
Q

What is a package?

A

a package is a directory with multiple files or modules and a package.json

38
Q

How can you create a package.json with npm?

A

npm init –yes

39
Q

What is a dependency and how to you add one to a package?

A

npm install jquery a dependency is third party code library that your application depends on to function.

40
Q

What happens when you add a dependency to a package with npm?

A

adds module to node_modules directory and the package.json is updated with the dependency

41
Q

how to vet a npm package.

A

visibility, documentation, userbase