Skip to content
Snippets Groups Projects
Commit 8f01d4cd authored by Nathan Meyer's avatar Nathan Meyer
Browse files

Finalize Lab02

parent de488262
Branches
No related tags found
No related merge requests found
Q1:
nim28@tux2 CS265> echo 'milk' > list
nim28@tux2 CS265> echo 'cookies' >> list
nim28@tux2 CS265> echo '#!/bin/bash' > Tmp/gotMe.bash
nim28@tux2 CS265> echo -e '\necho "I have no idea."' >> Tmp/gotMe.bash
nim28@tux2 CS265> find . -type f -mtime -2 -print
./GitLab/lab02/lab02
./GitLab/lab01/Tmp/gotMe.bash
./GitLab/lab01/Tmp/list
./GitLab/lab01/list
./GitLab/lab01/lab01.txt
Q2:
find . -type f -name *.bash
Q3:
nim28@tux2 lab02> cp ~kschmidt/public_html/CS265/Labs/Bash/breadIsDangerous.txt ./breadIsDangerous.txt
nim28@tux2 lab02> wc ./breadIsDangerous.txt
97 499 2960 ./breadIsDangerous.txt
nim28@tux2 lab02> ls -1 | wc -l
2
Q4:
ls -1 | wc -l
Q5:
nim28@tux2 lab02> grep -o bread breadIsDangerous.txt
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
Q6:
nim28@tux2 lab02> grep -o bread breadIsDangerous.txt | wc -l
21
\ No newline at end of file
# Lab_02
#### <u>Tux Lab</u>
__Q1:__
```bash
nim28@tux2 CS265> echo 'milk' > list
nim28@tux2 CS265> echo 'cookies' >> list
nim28@tux2 CS265> echo '#!/bin/bash' > Tmp/gotMe.bash
nim28@tux2 CS265> echo -e '\necho "I have no idea."' >> Tmp/gotMe.bash
nim28@tux2 CS265> find . -type f -mtime -2 -print
./GitLab/lab02/lab02
./GitLab/lab01/Tmp/gotMe.bash
./GitLab/lab01/Tmp/list
./GitLab/lab01/list
./GitLab/lab01/lab01.txt
```
__Q2:__
`find . -type f -name *.bash`
__Q3:__
```bash
nim28@tux2 lab02> cp ~kschmidt/public_html/CS265/Labs/Bash/breadIsDangerous.txt ./breadIsDangerous.txt
nim28@tux2 lab02> wc ./breadIsDangerous.txt
97 499 2960 ./breadIsDangerous.txt
nim28@tux2 lab02> ls -1 | wc -l
2
```
__Q4:__
`ls -1 | wc -l`
__Q5:__
```bash
nim28@tux2 lab02> grep -o bread breadIsDangerous.txt
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
bread
```
__Q6:__
```bash
nim28@tux2 lab02> grep -o 'the' breadIsDangerous.txt | wc -l
10
```
__Q7:__
```bash
nim28@tux2 lab02> cp ~kschmidt/public_html/CS265/Labs/Bash/spellExample spellExample.txt
nim28@tux2 lab02> ispell -b spellExample.txt
nim28@tux2 lab02> ls -1
breadIsDangerous.txt
lab02
spellExample.txt
spellExample.txt.bak
nim28@tux2 lab02>
```
New Backed up file (.bak)
__Q8:__
```bash
nim28@tux2 lab02> echo "An extra line" >> spellExample
nim28@tux2 lab02> diff spellExample.txt spellExample.txt.bak
1c1
< I went to a garden party
---
> I went to a gadren party
3c3
< bunch of my old friends did something
---
> bnuch of my old freinds did somehting
nim28@tux2 lab02>
```
Backed up file is not edited, regular file is edited.
__Q9:__
```bash
nim28@tux2 lab02> diff spellExample.txt spellExample.txt
nim28@tux2 lab02>
```
Nothing
__Q10:__
```bash
nim28@tux2 lab02> cp ~kschmidt/public_html/CS265/Labs/Bash/numbers numbers
nim28@tux2 lab02> sort numbers
1
15
17
20
24
26
28
29
6
9
nim28@tux2 lab02>
```
Yes, I know sorting defaults to character by character alphabetization.
__Q11:__
```bash
nim28@tux2 lab02> sort -n numbers
1
6
9
15
17
20
24
26
28
29
nim28@tux2 lab02>
```
Yes, -n means numerical order.
__Q12:__
Outputs in numerical order instead of alphabetical order.
__Q13:__
```bash
nim28@tux2 lab02> ls -oh | sort -k4 -h -r
-rw-r--r-- 1 nim28 2.9K Oct 4 14:34 breadIsDangerous.txt
-rw-rw-r-- 1 nim28 962 Oct 4 14:49 lab02
-rw-r--r-- 1 nim28 97 Oct 4 14:55 spellExample.txt
-rw-r--r-- 1 nim28 97 Oct 4 14:54 spellExample.txt.bak
-rw-r--r-- 1 nim28 27 Oct 4 15:05 numbers
-rw-rw-r-- 1 nim28 14 Oct 4 15:01 spellExample
total 6.0K
nim28@tux2 lab02>
```
Prints in order of filesize
__Q14:__
```bash
nim28@tux2 lab02> du -a | sort -n -r | head -n 8
7 .
3 ./breadIsDangerous.txt
1 ./spellExample.txt.bak
1 ./spellExample.txt
1 ./spellExample
1 ./numbers
1 ./lab02
nim28@tux2 lab02>
```
__Q15:__
```bash
nim28@tux2 lab02> grep dough breadIsDangerous.txt
roven that as little as one pound of dough can be used to
5. Bread is made from a substance called "dough." It has been
proven that as little as one pound of dough can be used to
nim28@tux2 lab02> echo $?
0
nim28@tux2 lab02> grep uniqueString breadIsDangerous.txt
nim28@tux2 lab02> echo $?
1
nim28@tux2 lab02> grep dough noSuchFile
grep: noSuchFile: No such file or directory
nim28@tux2 lab02> echo $?
2
nim28@tux2 lab02>
```
Stdin
Stdout
Stderr
#### <u>Git Lab</u>
__Q 2.1:__
`de488262e6665251da66cb348b2ddf24624ffe1d`
__Q 2.2:__
```bash
git reset # Changes position in work tree
git reset --hard # Modifies work tree
```
__Q 2.3:__
```bash
a6a2e69 Most recent commit
f07e105 The cutter commit
dabc8d2 The ketch commit
d51de8e The yawl commit
$ git show dabc8d2:marvin
```
__Q 2.4:__
`goto 2.1`
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment