Command Line Flashcards

1
Q

print work directory

A

pwd

shows what directory user is currently in.

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

$ means

A

type what follows into the terminal and hit return

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

list complete (unhidden) contents of current directory

A

ls

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

create a new folder in current directory

A

mkdir folderName

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

synonym for folder

A

directory

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

open a different directory

A

cd folderName

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

shortcut for home directory

A

~

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

abbreviation for the parent folder

A

..

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

to auto-complete in command line applications

A

press tab

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

agnostic terms for command line applications

A

“command line interface” or “the shell”

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

create or update a file on a Mac

A

touch

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

equivalent to “touch” for Linux or Windows

A

type NUL > filename.filetype

or, for advanced stuff but without the error message:
fsutil file createnew filename.filetype filesize

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

what does BASH stand for?

A

Bourne Again SHell (Bourne was the name of one of the original programs using the terminal)… means the same thing as CLI

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

copy a file

A

cp filename.fileytpe newfilename.filetype

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

delete a file

A

rm filename.filetype

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

delete a folder

A

rmdir folderName

does not work on Mac if folder has contents

17
Q

delete a folder on a Mac

A

rm -r

  • means “option” and r stands for “recursive.” this will, on a Mac, delete a folder and all its contents
18
Q

why is rm different than just deleting something on the GUI?

A

rm removes a file or folder and its contents permanently. It does not get sent to a trash folder. It cannot be recovered.

19
Q

what does rm -rf/ do?

A

it erases an entire hard drive. (rm = remove, r = recursive, f = force)

20
Q

see the last 500 or so things typed inside the terminal on a Mac or GitBash

A

history

in PowerShell, only shows history since application was last opened

21
Q

show contents of a file on Mac or in GitBash

A

less filename.filetype

(spacebar to advance through a long file /
q to close ensuing window)

22
Q

show contents of a file in PowerShell

A

Get-Content (filepath)filename.filetype

shows up on command line rather than opening new terminal window

23
Q

move a file

A

mv filename.filetype path

24
Q

rename a file

A

mv filename.filetype newfilename.filetype

25
Q

list all, including hidden files (and folders)

A

ls -a (a stands for “all”)

26
Q

create a hidden file

A

touch .filename.filetype

27
Q

abbreviation for current directory

A

.

28
Q

what does a space mean to the terminal?

A

it means two separate entities

29
Q

how do I enter a single entity into the terminal with a space in its title?

A

‘single entity’ (using a string)

30
Q

how do I prevent the terminal from reading a character or space as a command rather than just a character?

A

\ 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).