84 lines
2.0 KiB
Typst
84 lines
2.0 KiB
Typst
|
#set text(font: "FreeSans")
|
||
|
#align(center)[#text(size: 1.3em)[= CS 3424 Quiz - Week 2]]
|
||
|
|
||
|
#let info = ("Price Hiller", "zfp106", "Quiz 1", "CS 3424")
|
||
|
|
||
|
#let subheading = {
|
||
|
align(center)[#grid(
|
||
|
columns: 4,
|
||
|
gutter: 12pt,
|
||
|
align: center,
|
||
|
|
||
|
)]
|
||
|
}
|
||
|
|
||
|
#align(center)[
|
||
|
#("Price Hiller", "zfp106", "Quiz 1", "CS3424").join(" ⋄ ")
|
||
|
#line(length: 100%)
|
||
|
]
|
||
|
|
||
|
#let answer(ans) = {
|
||
|
align(center)[#block(
|
||
|
inset: 5pt,
|
||
|
stroke: blue + .5pt,
|
||
|
fill: rgb(0, 149, 255, 5%),
|
||
|
radius: 4pt,
|
||
|
)[#ans]]
|
||
|
}
|
||
|
|
||
|
1. Show a command to list all files beginning with 'A' and ending with a .zip extension
|
||
|
|
||
|
#answer[
|
||
|
```bash
|
||
|
echo A*.zip
|
||
|
```
|
||
|
]
|
||
|
|
||
|
2. Create an alias, `systems`, to change your current directory to *courses/cs3424/assignments* within your home directory.
|
||
|
|
||
|
#answer[
|
||
|
```bash
|
||
|
alias systems="cd ${HOME}/courses/cs3424/assignments"
|
||
|
```
|
||
|
]
|
||
|
|
||
|
3. Use symbolic modes to change the permissions of `output`.txt to remove execution rights from the group and other.
|
||
|
|
||
|
#answer[
|
||
|
```bash
|
||
|
chmod "g-x,o-x" output.txt
|
||
|
```
|
||
|
]
|
||
|
|
||
|
4. Use symbolic modes to change the permissions of all `.c` files in the current directory so the owner has read and execute access only, add read and write access to the group, and give everyone else reading access only.
|
||
|
|
||
|
#answer[
|
||
|
```bash
|
||
|
chmod "u=rwx,g+rw,o=r" *.c
|
||
|
```
|
||
|
]
|
||
|
|
||
|
5. Use octal notation to update `file1` to have read, write and execute access for the owner, read and write access for the group, and read access for everyone else. Hint for the octal values:
|
||
|
|
||
|
#align(center)[#table(
|
||
|
columns: 4,
|
||
|
align: horizon,
|
||
|
[octal], [read], [write], [execute],
|
||
|
[7], [1], [1], [1],
|
||
|
[6], [1], [1], [0],
|
||
|
[5], [1], [0], [1],
|
||
|
[4], [1], [0], [0],
|
||
|
[3], [0], [1], [1],
|
||
|
[2], [0], [1], [0],
|
||
|
[1], [0], [0], [1],
|
||
|
[0], [0], [0], [0],
|
||
|
)]
|
||
|
|
||
|
#answer[
|
||
|
```bash
|
||
|
chmod 0000000000000000000000000000000000000000000000000000000000000000000764 file1
|
||
|
```
|
||
|
|
||
|
#text(size: 0.75em)[_The above is, in fact, a valid octal value to pass to chmod._]
|
||
|
]
|