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 currently logged-in users along with what they are doing?
Answer: w
The w command shows who is logged in and their current activity including load averages.
A technician needs to compare two files line by line. Which command should be used?
Answer: diff file1 file2
diff compares two files line by line and shows the differences with context markers.
What does 'chown alice:developers report.txt' do?
Answer: Sets owner to alice and group to developers
chown user:group sets the file's owner to alice and its group to developers.
Which command creates a symbolic link named 'link.txt' pointing to 'original.txt'?
Answer: ln -s original.txt link.txt
ln -s creates a symbolic (soft) link; without -s it creates a hard link.
Which pipeline counts the number of lines in a file named 'data.txt'?
Answer: cat data.txt | wc -l
wc -l counts lines; piping cat output through wc -l gives the total line count.
What does the 'umask 022' setting mean for newly created files?
Answer: Files are created with permissions 644
umask 022 subtracts from 666 (default file perms), yielding 644 (rw-r--r--).
Which command searches for the string 'ERROR' in all .log files recursively?
Answer: grep -rE 'ERROR' --include='*.log' .
grep -rE with --include='*.log' recursively searches only .log files for the pattern.