Git Bash Commands - UNIX like (Wk 3 UCSD) Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is the UNIX shell?

A

Interpreter between the user and the kernel?

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

What is an abbreviation for a unique identifier that identifies a process running from the shell?

A

PID

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

Refer to parent dir

A

../

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

how do you refer the user’s home directory

A

~ or ~username/

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

list files and folders in unix dir

A

ls (get help for all of the options)

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

show contents of text files

A

cat filename

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

get the documentation for a unix command

A

man commandName, eg man ls (git bash, this doesn’t work - need to use help commandName, and doesn’t have all)

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

what is standard input

A

stdin - usually keyboard, but can read from file

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

what is standard output

A

stdout - usually terminal, but can be switched to file

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

what is standard error

A

stderr - usually terminal

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

command to make a directory

A

mkdir dirName

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

list hidden files

A

ls -a

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

copy file fruits.txt from parent directory to current directory

A

cp ../fruits.txt .

.. is parent; . is current dir

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

mv a file (eg, don’t copy)

A

mv path/file targetDir

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

list all files with .txt extension in parent directory using wildcard

A

ls .. *.txt

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

how to redirect standard input to a file

A

command < filenamein

17
Q

redirect standard output to a file

A

command > filenameout

18
Q

redirect standard error to a file

A

command 2> errorout

19
Q

redirect standard out and error in one command

A

command 2> errorout > fileout

20
Q

how do you append to a file instead of redirecting

A

command&raquo_space; fileout 2» fileerror

21
Q

send standard error and stdout to same file

A

command > afile 2>&1

22
Q

list out lines of text file screen by screen

A

less filename (q to exit reviewing line by line)

23
Q

sort lines in fruits.txt and write to fruits2.txt

A

sort fruits.txt > fruits2.txt (sorts alphabetically)

24
Q

get unique lines in a file and write to file2

A

uniq fruits.txt > file2

25
Q

count number of words in a file, or just lines

A

wc filename.txt, wc -l filename.txt (just lines)

26
Q

execute both pwd command and ls -l, with ls -l out to a file

A

pwd; ls -l > filelsout

27
Q

combine pwd command with ls -l, with both outputs to a file

A

(pwd; ls -l) > filebothout