Command-Line Interface Flashcards
7 cards from real ACSP practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Command-Line Interface flashcards as text
Which command displays the current user's username in macOS Terminal?
Answer: whoami
The `whoami` command prints the effective username of the currently logged-in user.
A technician wants to view only the last 20 lines of a large log file. Which command achieves this?
Answer: tail -n 20 logfile.log
`tail -n 20` outputs the last 20 lines of the specified file.
Which command would you use to change the ownership of a file to a different user in macOS?
Answer: chown newuser filename
`chown` (change owner) sets the user and/or group ownership of a file.
What does the `&&` operator do when used between two shell commands?
Answer: Runs the second command only if the first succeeds
`&&` is a logical AND; the second command executes only when the first exits with status 0 (success).
Which `find` command locates all `.log` files modified within the last 7 days under `/var/log`?
Answer: find /var/log -name '*.log' -mtime -7
`find` with `-mtime -7` matches files modified less than 7 days ago.
A user runs `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder`. What is the purpose of this command sequence?
Answer: Flush the DNS cache on macOS
This two-command sequence flushes the DNS cache and restarts mDNSResponder to apply the change on modern macOS.
Which command can be used to compress a folder named `reports` into a gzip-compressed tar archive called `reports.tar.gz`?
Answer: tar -czf reports.tar.gz reports
`tar -czf` creates (`c`) a gzip-compressed (`z`) archive file (`f`) from the specified directory.