Basic Linux Commands Linux Quiz : 4
Question 1:
Which option with the ls
command will display file sizes in human-readable format?
A) -h
B) -s
C) -m
D) -r
Answer: A) -h
Question 2:
What does the cat
command with the -n
option do?
A) Numbers the lines of a file
B) Concatenates files
C) Displays file contents in reverse
D) Deletes file contents
Answer: A) Numbers the lines of a file
Question 3:
Which command would you use to list all files in the current directory, including hidden files, in long format?
A) ls -la
B) ls -al
C) ls -l
D) ls -a
Answer: A) ls -la
Question 4:
Which command is used to display the disk usage of a directory and its subdirectories?
A) du
B) df
C) ls
D) find
Answer: A) du
Question 5:
Which command is used to search for a file in the filesystem?
A) find
B) locate
C) grep
D) search
Answer: A) find
Question 6:
What does the grep
command do?
A) Searches for a pattern within files
B) Lists all files
C) Displays file permissions
D) Changes file ownership
Answer: A) Searches for a pattern within files
Question 7:
Which command is used to display the calendar for the current month?
A) cal
B) date
C) calendar
D) month
Answer: A) cal
Question 8:
Which option with the ps
command shows a detailed view of processes?
A) -f
B) -l
C) -e
D) -a
Answer: A) -f
Question 9:
What does the tar
command do?
A) Archives files into a single file
B) Compresses files
C) Lists files
D) Moves files
Answer: A) Archives files into a single file
Question 10:
Which command shows the last few lines of the system log file?
A) tail /var/log/syslog
B) head /var/log/syslog
C) cat /var/log/syslog
D) more /var/log/syslog
Answer: A) tail /var/log/syslog
0 Comments