Operations 14 min read

Top 30 Linux Command Quiz with Answers to Test Your Sysadmin Skills

This article presents a comprehensive set of 30 multiple‑choice Linux questions covering commands, file permissions, process management, networking, and shell scripting, followed by the correct answers, providing a practical self‑assessment for system administrators and Linux learners.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Top 30 Linux Command Quiz with Answers to Test Your Sysadmin Skills

Question List

1. What does the command cat -n file1 file2 do?

A. Output only the contents of file1

B. Concatenate file1 and file2 and display them

C. Create file1 and file2

D. Write the contents of file2 into file1

2. Which command shows which ports services are using on Linux?

A. ps -aux B. netstat –apn C. watch D. lsof 3. Which statement about Linux is correct?

A. When a thread accesses illegal memory, it enters a signal handler

B. Using mv changes the file's modification time

C. ulimit -c sets the stack size

D. malloc is the interface for applications to request memory from the OS

4. Which command cannot be used to view file contents?

A. cat

B. ls

C. less

D. more

5. Which command extracts specified fields from each line of a text file?

A. cp

B. dd

C. fmt

D. cut

6. Which command shows disk usage on Linux?

A. dd

B. df

C. top

D. netstat

7. If umask is 002, what are the default permissions for a newly created file?

A. -rw-rw-r--

B. rwxrwx-w-

C. ——-w-

D. rwxrwxr-x

8. An executable owned by root with the setuid bit set is run by user mike . What are the effective and real user IDs of the resulting process?

A. effective=root, real=mike

B. effective=root, real=root

C. effective=mike, real=root

D. effective=mike, real=mike

E. effective=daemon, real=mike

F. effective=mike, real=daemon

9. Which directory stores system configuration files and sub‑directories?

A. /etc

B. /var

C. /root

D. /home

10. File exer1 has permissions rw-r--r-- . Which command correctly adds execute permission for all users and write permission for the group?

A. chmod a+x g+w exer1 B. chmod 765 exer1 C. chmod o+x g+w exer1 D. chmod g+w exer1 11. Which command lists active processes on Linux?

A. ps

B. netstat

C. df

D. ifconfig

12. Which command displays the current directory?

A. pwd B. echo pwd C. $pwd D. pwd | echo 13. The correct field order for a crontab entry is:

A. MIN HOUR DAY MONTH YEAR COMMAND

B. MIN HOUR DAY MONTH DAYOFWEEK COMMAND

C. COMMAND HOUR DAY MONTH DAYOFWEEK

D. COMMAND YEAR MONTH DAY HOUR MIN

14. Which command shows the ARP cache on Linux?

A. arp –a B. arp –d C. arp -L D. arp –D 15. Which function does NOT belong to the same group as the others?

A. fread

B. gets

C. getchar

D. pread

E. getline

F. scanf

16. In XDM’s configuration, which file defines applications started after a user logs in?

A. The Xsession file

B. The Xsetup_0 file

C. The Xstart_up file

D. The GiveConsole file

17. Set permissions for start.sh so the owner can read/write/execute, the group can read/execute, and others have no rights.

A. chmod start.sh 706 B. chmod start.sh 750 C. chmod start.sh 705 D. chmod start.sh 777 18. When using select() to monitor sockets 5, 17, and 19, what should maxfd be set to?

A. 4

B. 20

C. 5

D. 9

19. (Duplicate of 8) – see answer above.

20. In which memory segment are uninitialized global variables stored?

A. BSS

B. TEXT

C. DATA

D. STACK

21. How many processes are created by int main(){fork()||fork();} ?

A. 1

B. 2

C. 3

D. 4

E. 5

F. 6

22. Which situation does NOT require recompiling the kernel?

A. Deleting unused device drivers

B. Upgrading the kernel

C. Adding new hardware

D. Activating a network card

23. Which statement about pipe communication is correct?

A. A pipe can provide bidirectional data transfer

B. Pipe capacity is limited only by disk size

C. Reads or writes on a pipe may block

D. Only one reader or one writer may use a pipe

24. Which commands can display lines 300‑500 of file1 ? (multiple correct)

A. cat file1 | tail -n +300 | head -n 200 B. cat file1 | head -n 500 | tail -n +300 C. sed -n '300,500p' file1 25. Which commands correctly show current CPU, memory, and load information? (multiple correct)

A. top B. free C. cat /proc/meminfo D. None of the above

26. Which memory management schemes can cause external fragmentation? (multiple correct)

A. Paging

B. Segmentation

C. Demand paging

D. Demand segmentation

27. Which redirection forms correctly send both stdout and stderr of demo.sh to demo.log ? (multiple correct)

A. bash demo.sh >&demo.log B. bash demo.sh >&demo.log C. bash demo.sh >demo.log 2>&1 D. bash demo.sh 2>demo.log 1>demo.log 28. Which commands set the /www directory to be executable only by the owner? (multiple correct)

A. chmod 100 /www B. chmod 001 /www C. chmod u+x,g-x,o-x /www D. chmod o-x,g-x,u-x /www 29. In awk 'BEGIN { Arr[2,79]=78 ... }' , which statement makes the output 78? (multiple correct)

A. print Arr["2\03479"] B. print Arr[2,79] C. idx=2 SUBSEP 79; print Arr[idx] D. print Arr[ 2, 79] 30. Fill in the blanks: A file with permissions drw-r--r-- is represented numerically as ___, and the command to change permissions is ___.

Answer: 644;

chmod

Answer Key

1. B 2. B 3. A 4. B 5. D 6. B 7. A 8. A 9. A 10. A 11. A 12. A 13. B 14. A 15. D 16. B 17. B 18. B 19. A 20. A 21. C 22. D 23. C 24. ABC 25. ABC 26. BD 27. ABC 28. AC 29. ABCD 30. 644;chmod

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxUnix
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.