ACSP Command-Line Interface 5 — Questions and Answers
Question 1: What is the effect of running `chmod 755 script.sh` on the file `script.sh`?
- Owner gets read/write/execute; group and others get read/execute (Correct answer)
- Everyone gets full read/write/execute permissions
- Owner gets read/write; group and others get read only
- Only the owner can read and execute the file
Correct answer: Owner gets read/write/execute; group and others get read/execute
755 in octal means rwx (7) for owner, r-x (5) for group, and r-x (5) for others.
Question 2: Which command displays a real-time, continuously updating list of running processes on macOS?
- top (Correct answer)
- ps aux
- activity
- proc -live
Correct answer: top
`top` provides a live, auto-refreshing view of CPU and memory usage by process.
Question 3: A technician needs to search all `.txt` files in the current directory for the word 'error' (case-insensitive). Which command is correct?
- grep -i 'error' *.txt (Correct answer)
- find . -name '*.txt' -search 'error'
- cat *.txt | search -i error
- awk '/error/' *.txt -ignorecase
Correct answer: grep -i 'error' *.txt
`grep -i` performs a case-insensitive search across the specified files.
Question 4: What does `diskutil list` display in macOS Terminal?
- All attached disks and their partitions with identifiers (Correct answer)
- Free and used disk space for each volume
- SMART status for all connected drives
- Mounted network shares and local volumes
Correct answer: All attached disks and their partitions with identifiers
`diskutil list` enumerates all disks and their partition schemes, sizes, and BSD device identifiers.
Question 5: A support technician wants to redirect the error output of a command to a file called `errors.txt`. Which syntax is correct?
- command 2> errors.txt (Correct answer)
- command > errors.txt 2
- command 1> errors.txt
- command &> /dev/null errors.txt
Correct answer: command 2> errors.txt
File descriptor 2 represents stderr; `2>` redirects standard error to the specified file.
Question 6: Which command shows the network routing table on macOS?
- netstat -rn (Correct answer)
- ifconfig -r
- route -list
- networksetup --routes
Correct answer: netstat -rn
`netstat -rn` displays the kernel routing table in numeric form without DNS resolution.
Question 7: When using `defaults write` in Terminal, what kind of data is being modified?
- Application preference values stored in property list files (Correct answer)
- Default user account settings in Directory Services
- System-wide kernel parameters in sysctl
- Factory reset defaults in the NVRAM
Correct answer: Application preference values stored in property list files
`defaults write` modifies per-application preference keys stored in .plist files in ~/Library/Preferences.
What is the effect of running `chmod 755 script.sh` on the file `script.sh`?