CompTIA Linux+ Linux GNU and Unix Commands Flashcards
7 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 CompTIA Linux+ Linux GNU and Unix Commands flashcards as text
Which command displays the last 20 lines of a file named 'syslog'?
Answer: tail -20 syslog
tail -n 20 (or tail -20) displays the last 20 lines of a file.
A sysadmin wants to find all files modified in the last 2 days. Which find option is correct?
Answer: -mtime -2
find -mtime -2 matches files with modification time less than 2 days ago.
Which command shows disk usage of the current directory in human-readable format?
Answer: du -sh .
du -sh . summarizes (-s) disk usage of the current directory in human-readable (-h) format.
What does the command 'chmod 755 script.sh' set for group permissions?
Answer: read and execute
In 755, the middle digit 5 (r-x) gives group read and execute permissions.
Which command is used to rename a file in Linux?
Answer: mv
mv (move) is used to rename files by moving them to a new name in the same directory.
What is the output of 'echo $?' after a command exits successfully?
Answer: 0
$? holds the exit status of the last command; 0 indicates success.
Which command sorts the contents of 'names.txt' in reverse alphabetical order?
Answer: sort -r names.txt
sort -r reverses the sort order, producing reverse alphabetical output.