Showing raw Markdown: the renderer could not load.
## Questions ### 1. Why do cloud labs, and cloud engineers, use a terminal instead of clicking through menus? *Objective: 1. Open a terminal on Windows (WSL), macOS or Linux and explain what a command, an argument and the prompt are.* - A) Typed commands are precise and repeatable, and they work on servers that have no screen. - B) Terminals are faster than graphical programs for every task, including editing photos. - C) Graphical programs can't be used on cloud servers because they are not secure. - D) Typed commands can't make mistakes, so they never need checking. ### 2. A tutorial shows `user@laptop:~$ ls -l photos`. What do you type? *Objective: 1. Open a terminal on Windows (WSL), macOS or Linux and explain what a command, an argument and the prompt are.* - A) The whole line, including `user@laptop:~$`. - B) `$ ls -l photos`, because the dollar sign starts every command. - C) `ls -l photos`: the prompt is already on your screen. - D) `photos`, because `ls` and `-l` are only decoration. ### 3. You open a new terminal and run `pwd`. It prints `/home/user`. Then you run `cd documents`. What does that `cd` try to do? *Objective: 2. Move between folders and list their contents with `pwd`, `ls` and `cd`.* - A) Go to `/home/user/documents`, because a name with no leading `/` is relative to where you are. - B) Go to `/documents`, because every folder name is searched from the root. - C) Create the folder `documents` if it doesn't exist. - D) List the contents of `documents`, which is what `cd` stands for. ### 4. You are in `/home/user/terminal-practice/photos`. Which command lists the files in the folder `notes` next to `photos`, without moving? *Objective: 2. Move between folders and list their contents with `pwd`, `ls` and `cd`.* - A) `ls notes` - B) `ls ../notes` - C) `ls ./notes` - D) `ls ~/notes` ### 5. You run `echo "second" > list.txt` in a folder where `list.txt` already contains the single line `first`. What does `cat list.txt` show afterwards? *Objective: 3. Create, read, copy, move and delete files and folders with `mkdir`, `touch`, `cat`, `cp`, `mv` and `rm`.* - A) `second` only, because `>` replaces the contents of the file. - B) `first` and then `second`, because `>` adds a line. - C) `first` only, because the file already exists and is protected. - D) An error, because `echo` can't write to a file. ### 6. You want a safe copy of `report.txt` named `report-old.txt` and need to keep the original. Which command do you use? *Objective: 3. Create, read, copy, move and delete files and folders with `mkdir`, `touch`, `cat`, `cp`, `mv` and `rm`.* - A) `mv report.txt report-old.txt` - B) `touch report.txt report-old.txt` - C) `rm report.txt report-old.txt` - D) `cp report.txt report-old.txt` ### 7. You type `cat budget.txt` and the terminal answers `cat: budget.txt: No such file or directory`. You are sure you saved the file yesterday. What is the most likely explanation? *Objective: 4. Read error messages and get help with `--help` and `man`.* - A) The terminal is broken and needs to be reinstalled. - B) You don't have permission, so you should retry with `sudo`. - C) You are probably in a different folder, or the name is spelled differently, so check with `pwd` and `ls`. - D) `cat` only works on files created today. ### 8. You want to know what options the `cp` command accepts. Which is the best first move on a Linux system? *Objective: 4. Read error messages and get help with `--help` and `man`.* - A) Run `cp --help`, or `man cp` for the full manual (press `q` to leave it). - B) Run `cp` with random options and see what happens. - C) Run `rm cp` to remove the old version and try again. - D) Nothing: command options can only be learned by heart. --- ## Answer key <details> <summary>Show answers</summary> | # | Answer | Explanation | |---|---|---| | 1 | A | Typed commands are exact, can be repeated or shared, and work on servers without a screen. They are not faster for every task (B), and being typed doesn't make them safer or error-free (D). | | 2 | C | The prompt (`user@laptop:~$`) is printed by the terminal. You type only the command, its option and its argument: `ls -l photos`. | | 3 | A | A path that doesn't start with `/` is relative to the current folder, so `documents` means `/home/user/documents`. `cd` changes folder; it doesn't create (C) or list (D). | | 4 | B | `..` goes up one level to `terminal-practice`, then `notes` goes down. `ls notes` (A) looks for `photos/notes`, `ls ./notes` (C) means the same thing, and `ls ~/notes` (D) looks in your home folder. | | 5 | A | A single `>` replaces the file's contents. `>>` would add a line (B). | | 6 | D | `cp <from> <to>` copies and leaves the original. `mv` (A) renames it, so the original name disappears. `rm` (C) deletes, and `touch` (B) creates empty files. | | 7 | C | The message means the shell can't find that name in the current folder: a different folder or a spelling difference. `pwd` and `ls` show which. It isn't a permission problem (B), which would say `Permission denied`. | | 8 | A | `--help` gives a short summary, and `man` the full manual. Trying random options (B) can change or delete things, and `rm cp` (C) would remove a system program. | </details>