bash Flashcards

1
Q

Exit the history search.

A

ctrl + g

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

See the previous command in the history.

A

ctrl + p

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

See the next command in the history.

A

ctrl + n

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

Go to the beginning of the line in bash prompt

A

ctrl + a

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

Go to the end of the bash prompt line

A

ctrl + e

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

move cursor forward on bash prompt by 1 character

A

ctrl + f

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

move cursor backward on bash prompt by 1 character

A

ctrl + b

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

deletes forward to end of bash line

A

ctrl + k

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

deletes backwards to beginning of bash line

A

ctrl + u

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

delete backwards to the start of a word in bash prompt

A

ctrl + w

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

delete the character under the cursor in the bash prompt

A

ctrl + h

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

paste in the last item that you deleted or killed from the bash prompt, like when you ctrl + w, u, k, h, etc

A

ctrl + y

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

count words in a file

A

wc -w file

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

count lines in a file

A

wc -l file

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

count characters in a file

A

wc -c file
or
wc -m file … if you want to take multi-byte character sets into account

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

explain:

cat > trumpet &laquo_space;stop

A

this will change the terminal to input for the file “trumpet” and let you keep creating new lines of input until you type the word “stop” and press return. pretty cool, but I’m not sure why it works like it does lol

17
Q

How do you grep search all the files in a directory? (recursively)

A

grep -r

18
Q

how do you copy a directory of stuff?

A

cp -r

19
Q

show a calendar

A

cal

20
Q

show current date

A

date

21
Q

show disk usage in human readable format

A

df -h

f for filesystem? heh

22
Q

show disk usage of a file/folder but not the folders inside it

A

du -sh

u for underneath filesystem? heh

23
Q

show disk usage of a file/folder and the folders inside it

A

du -h

24
Q

how do you download a file with curl?

A

curl –output

25
Q

how do you download a file with wget and name it what you want

A

wget -o

26
Q

how do you download full page with wget

A

wget

27
Q

print process id of the current shell

A

echo $$

28
Q

print process id of the most recently invoked background job

A

echo $!

29
Q

display exit status of last command

A

echo $?

30
Q

read a string from input and assign it to a variable you could echo $variable out

A

read