Keyboard and generated files

Quick check: can you stand in the folder, rebuild it, and generate the page with > and |?

Pass at 70%. Feedback appears as you go, and only your first answer to each question counts.

Question 1 of 6

You are in ~/projects/first-site. What does bare cd do, and what does cd - do after that?

Show answer

Answer:

Bare cd goes home ($HOME). cd - then jumps back to ~/projects/first-site and prints that path.

A full-credit answer shows: A strong answer covers: (1) bare cd goes to home; (2) cd - returns to the previous directory and prints it.

Bare cd is home. cd - toggles and prints the destination. Confirm with pwd (objective 3).

Question 2 of 6

What does ls -la | grep html | wc -l do, in order?

Show answer

Answer:

ls -la lists the folder. grep html keeps the lines that mention html. wc -l counts those lines. Nothing is written to disk unless you add > or >>.

A full-credit answer shows: A strong answer covers: (1) list; (2) filter lines containing html; (3) count those lines; (4) the pipe does not write a file by itself.

Each stage reads what the previous stage printed. The pipe is a connection, not a save (objective 8).

Question 3 of 6

mkdir ~/projects/first-site/deep/nested without -p fails if deep does not exist. mkdir -p of the same path succeeds.

Show answer

Answer: True

-p makes parent directories as needed and does not complain if they already exist. Without it you get No such file or directory (objective 4).

Question 4 of 6

rm puts deleted files in the Trash, so you can undo a bad delete from the file manager.

Show answer

Answer: False

The opposite is true. rm has no trash and no undo. Copy the file out first if you still need it (objective 5).

Question 5 of 6

You run ls in /home/sam and then cd projects/first-site and ls again. The listing changes. What changed?

Show answer

Answer: The shell is standing in a different folder, so the same command lists different files

The command did not change. The vantage point did. pwd would print a different path after the cd (objectives 1, 2).

Question 6 of 6

b already exists and is a directory. What does mv a b do?

Show answer

Answer: Moves a into b, so the result is b/a

When the destination is an existing directory, mv moves into it. When b does not exist, mv a b is a rename. That pair is the whole trap (objective 6).

Erase saved progress?

This erases all quiz scores, reading progress, project checklists, and your name on the certificate. It cannot be undone, and it affects only this course in this browser.