MauryaHub PYQ Practice

System Commands · Quiz 1 · Jan 2026

System Commands · Quiz 1 · Jan 2026

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

16 / 16 published solutions

Question 2 NAT · 3.0 marks

Source diagram or notation

Published solution

**1. Follow the hard links:** touch creates project.doc with one inode. project_copy and project_backup are hard links to that same inode. **2. Count the symbolic link:** project_link is a separate symbolic-link object with its own inode. Thus the four names represent two newly allocated inodes. **Answer: 2.** **Convention note:** This counts the objects created by the commands, excluding already existing directory and filesystem inodes.

Report a correction for Q2

Question 3 MSQ · 3.0 marks

Source diagram or notation
6406536344962.Source diagram or notation
6406536344963.Source diagram or notation
6406536344964.Source diagram or notation
6406536344965.Source diagram or notation
6406536344966.Source diagram or notation

Published solution

**1. Decode the three permission fields:** report.txt is rw-r--r--; compile.sh is rwxr-----; readme.md is r--r--r--. **2. Apply the relevant category:** The report owner has write permission; dev has read permission on the report. Neither group nor others has execute permission on compile.sh. Every category has read permission on readme.md. **Answer: A, D, E — A, D and E.** **Convention note:** Permission statements use the normal owner/group/others model and assume the necessary directory access. The owner’s rights are evaluated as owner, not as a group member. A: **Correct:** The owner field of report.txt includes w. B: **Incorrect:** The others field of compile.sh is ---, so ordinary nonowners outside dev cannot execute it. C: **Incorrect:** The dev group field is r--, without x. D: **Correct:** The group field of report.txt contains r. E: **Correct:** Owner, group and others all have r.

Report a correction for Q3

Question 4 MSQ · 3.0 marks

Source diagram or notation
6406536344987.Source diagram or notation
6406536344988.Source diagram or notation
6406536344989.Source diagram or notation
6406536344990.Source diagram or notation
6406536344991.Source diagram or notation

Published solution

**1. Compare default regex syntax:** egrep is the ERE form of grep -E. In ERE, |, + and ? have their special meanings without backslashes; plain grep uses BRE, where these unescaped symbols do not have those meanings. **2. Select the syntax statements:** A and B describe the unescaped syntax difference, and D gives the equivalent invocation. C incorrectly claims identical syntax; E reverses the modes. **Answer: A, B, D — A, B and D.** **Convention note:** GNU BRE also supports escaped \|, \+ and \? as extensions. Thus “grep does not” in A/B refers to the unescaped operator forms, not a complete lack of equivalent functionality. A: **Correct:** Unescaped | supplies alternation in ERE, unlike BRE. B: **Correct:** Unescaped + and ? are ERE repetition operators, unlike their unescaped BRE forms. C: **Incorrect:** The default syntaxes differ. D: **Correct:** egrep conventionally invokes the grep -E mode. E: **Incorrect:** Plain grep defaults to BRE and egrep to ERE.

Report a correction for Q4

Question 5 MSQ · 3.0 marks

Source diagram or notation
6406536344996.Source diagram or notation
6406536344997.Source diagram or notation
6406536344998.Source diagram or notation
6406536344999.Source diagram or notation

Published solution

**1. Enforce both boundaries:** ^report requires the lowercase prefix at the beginning; \.txt$ requires the literal extension at the end. **2. Compare the middle:** A permits any characters with .*; C permits non-slash characters with [^/]*. No supplied line contains a slash, so these produce the same desired lines. **Answer: A, C — Commands A and C.** A: **Correct:** It enforces the exact prefix and suffix while allowing intermediate characters. B: **Incorrect:** -w is not an end-of-line anchor; report.txt.bak can still match the report.txt word. C: **Correct:** On the given slash-free lines it matches exactly the same desired filenames as A. D: **Incorrect:** It matches only report.txt, omitting report1.txt and other valid extensions of the prefix.

Report a correction for Q5

Question 6 MCQ · 3.0 marks

Source diagram or notation
6406536344967.Source diagram or notation
6406536344968.Source diagram or notation
6406536344969.Source diagram or notation
6406536344970.Source diagram or notation

Published solution

**1. Specify the character positions:** After file_, [a-z] requires one lowercase letter and [0-9] requires one digit; .txt is a literal glob suffix. **2. Count the matching names:** file_a1.txt and file_b2.txt match. ls writes them to the pipe one per line under ordinary output settings, and wc -l counts those lines. **Answer: C — ls file_[a-z][0-9].txt | wc -l.** **Convention note:** The question’s intended prefix includes the underscore shown in the filenames. This familiar ls-count pipeline assumes ordinary filenames and at least one match. A: **Incorrect:** ?? accepts any two characters, including the wrong order or two letters. B: **Incorrect:** Each class permits letters or digits, so it is too broad. C: **Correct:** It imposes the requested letter-then-digit order. D: **Incorrect:** It requires digit-then-letter, the opposite order.

Report a correction for Q6

Question 7 MCQ · 3.0 marks

What is the primary purpose of the SSH private key during authentication?
6406536344971.
It is sent to the server to verify the user
6406536344972.
It encrypts all network traffic directly
6406536344973.
It is used by the client to prove its identity to the server without sending the key itself
6406536344974.
It stores the server’s host fingerprint

Published solution

**1. Prove possession:** During public-key authentication the client signs authentication data using its private key. The server verifies the signature using the authorized public key; the private key stays on the client. **Answer: C — It is used by the client to prove its identity to the server without sending the .** A: **Incorrect:** The private key itself is not sent to the server. B: **Incorrect:** Session encryption normally uses separately negotiated symmetric keys. C: **Correct:** A signature proves possession without disclosing the private key. D: **Incorrect:** Server fingerprints are recorded separately, typically in known_hosts.

Report a correction for Q7

Question 8 MCQ · 3.0 marks

Source diagram or notation
6406536344975.
1-D, 2-C, 3-A, 4-B
6406536344976.
1-D, 2-C, 3-B, 4-A
6406536344977.
1-B, 2-C, 3-D, 4-A
6406536344978.
1-B, 2-C, 3-A, 4-D

Published solution

**1. Match Vim:** :q! quits without saving (D); :set number displays line numbers (C); :x saves if modified and quits (B); :! runs an external command (A). **2. Match Emacs:** M-< moves to buffer beginning (D); C-a to line beginning (C); M-> to buffer end (B); C-e to line end (A). Both tables therefore use 1-D,2-C,3-B,4-A. **Answer: B — 1-D, 2-C, 3-B, 4-A for both tables.** A: **Incorrect:** It swaps the third and fourth functions. B: **Correct:** This mapping agrees with both editor tables. C: **Incorrect:** It misassigns quit/save functions. D: **Incorrect:** It misassigns quit and terminal-command functions.

Report a correction for Q8

Question 9 MCQ · 3.0 marks

Source diagram or notation
6406536344979.Source diagram or notation
6406536344980.Source diagram or notation
6406536344981.Source diagram or notation
6406536344982.Source diagram or notation

Published solution

**1. Redirect stdout:** > output.txt creates or truncates the normal-output file. **2. Redirect stderr:** 2>> errors.txt appends descriptor 2 while preserving previous error content. Combining the two gives option A. **Answer: A — ./run_test.sh > output.txt 2>> errors.txt.** A: **Correct:** It truncates stdout’s file and appends stderr’s file. B: **Incorrect:** It reverses append and overwrite behaviour. C: **Incorrect:** &>> combines both streams into output.txt; errors.txt is then an argument. D: **Incorrect:** It sends the two streams to the opposite requested files.

Report a correction for Q9

Question 10 MCQ · 3.0 marks

Source diagram or notation
6406536344983.Source diagram or notation
6406536344984.Source diagram or notation
6406536344985.Source diagram or notation
6406536344986.Source diagram or notation

Published solution

**1. Gate deployment on success:** && runs the deployment pipeline only when ./build.sh succeeds. **2. Filter deployment output:** The pipeline ./deploy.sh | grep "SUCCESS" > deploy.log saves just the matching deployment lines. This is the structure in A. **Answer: A — ./build.sh && ./deploy.sh | grep "SUCCESS" > deploy.log.** **Convention note:** This saves matching lines but does not simultaneously show them on the terminal. If “display” literally requires both destinations, use grep -w "SUCCESS" | tee deploy.log; -w also enforces the whole word. A is the intended offered pipeline. A: **Correct:** It gates the deployment pipeline on build success and saves its filtered output. B: **Incorrect:** It filters build output and saves unfiltered deployment output. C: **Incorrect:** The deployment stdout redirection bypasses grep’s input. D: **Incorrect:** || starts deployment after build failure instead of success.

Report a correction for Q10

Question 11 MCQ · 3.0 marks

Source diagram or notation
6406536344992.Source diagram or notation
6406536344993.Source diagram or notation
6406536344994.Source diagram or notation
6406536344995.Source diagram or notation

Published solution

**1. Parse the anchored pattern:** ^[a-z0-9._]+ allows one or more lowercase letters, digits, dots or underscores before @; [a-z]+ requires lowercase letters in the next component. **2. Parse the ending:** \. is a literal dot and [a-z]{2,4}$ requires a two-to-four-letter final component at the end. The whole line must match this simplified email form. **Answer: B — Complete simplified lowercase email form with a 2–4 letter suffix.** **Convention note:** The 2–4 length restriction applies to the final suffix, not the full domain name. The regex is a classroom pattern rather than a complete email-address validator. A: **Incorrect:** The anchors prohibit arbitrary extra text, and digits and punctuation are allowed in the local part. B: **Correct:** It describes the complete anchored lowercase email-like form. C: **Incorrect:** The local part may start with a digit, dot or underscore too. D: **Incorrect:** The pattern constrains the entire line rather than any @ and dot occurrence.

Report a correction for Q11

Question 12 MCQ · 3.0 marks

Source diagram or notation
6406536345004.
1–A, 2–B, 3–C, 4–D
6406536345005.
1–D, 2–C, 3–B, 4–A
6406536345006.
1–C, 2–D, 3–A, 4–B
6406536345007.
1–C, 2–A, 3–D, 4–B

Published solution

**1. Match each tool:** ping sends reachability probes (C); traceroute discovers a hop-by-hop route (D); nslookup queries DNS (A); netstat reports network connections and related statistics (B). **Answer: C — 1-C, 2-D, 3-A, 4-B.** A: **Incorrect:** Every mapping is shifted away from the tool’s function. B: **Incorrect:** The functions are reversed. C: **Correct:** All four command-purpose mappings are correct. D: **Incorrect:** It swaps the DNS and route-discovery functions.

Report a correction for Q12

Question 13 MCQ · 3.0 marks

Source diagram or notation
6406536345008.
Only Statement I is true
6406536345009.
Only Statement II is true
6406536345010.
Both Statement I and Statement II are true
6406536345011.
Both Statement I and Statement II are false

Published solution

**1. Apply AND-list semantics:** cmd1 && cmd2 executes cmd2 after a zero exit status from cmd1. **2. Apply OR-list semantics:** cmd1 || cmd2 executes cmd2 after a nonzero exit status from cmd1. Therefore both statements are true. **Answer: C — Both statements are true.** A: **Incorrect:** Statement II is also true. B: **Incorrect:** Statement I is also true. C: **Correct:** Both are the shell’s short-circuit rules. D: **Incorrect:** Both stated rules are correct.

Report a correction for Q13

Question 14 MCQ · 4.0 marks

Source diagram or notation
6406536345000.Source diagram or notation
6406536345001.Source diagram or notation
6406536345002.Source diagram or notation
6406536345003.Source diagram or notation

Published solution

**1. Isolate the prefix:** head -11 produces lines 1 through 11. **2. Keep the requested seven lines:** There are \(11-5+1=7\) lines from 5 to 11; tail -7 on the prefix yields exactly them. **Answer: D — cat longfile.txt | head -11 | tail -7.** A: **Incorrect:** It keeps only lines 1–4. B: **Incorrect:** It takes four lines from the file’s last eleven. C: **Incorrect:** It takes the last seven lines of the entire file. D: **Correct:** It takes the final seven lines of the first eleven.

Report a correction for Q14

Question 15 MCQ · 4.0 marks

Source diagram or notation
6406536345012.
The command filters only Class A IP addresses (1–126) and excludes loopback addresses.
6406536345013.
The command filters Class A and loopback IP addresses.
6406536345014.
The command filters Class A and Class B IP addresses.
6406536345015.
The command filters only Class B IP addresses.

Published solution

**1. Expand the alternatives:** [1-9] covers 1–9, [1-9][0-9] covers 10–99, 1[0-1][0-9] covers 100–119, and 12[0-6] covers 120–126. **2. Apply the boundaries:** ^ anchors the first octet and \. ends it. Thus first octets 1–126 match, while 127 and all Class B octets do not. **Answer: A — Only the stated Class A range, excluding loopback.** A: **Correct:** The alternatives cover precisely the stated Class A range. B: **Incorrect:** 127 is excluded by the final digit range 0–6. C: **Incorrect:** Class B starts at 128 and is excluded. D: **Incorrect:** No first octet 128–191 matches.

Report a correction for Q15

Question 16 MSQ · 3.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
Source diagram or notation
6406536345016.Source diagram or notation
6406536345017.Source diagram or notation
6406536345018.Source diagram or notation
6406536345019.Source diagram or notation

Published solution

**1. Create the new directory and file:** Docs exists, so mkdir Docs/Guides succeeds. touch Docs/Guides/linux.md places the empty file correctly. **2. Generate the reports:** B uses report{2..10}.txt; D explicitly lists report2 through report10 inside braces. Both create the nine requested files in Work/Reports. **Answer: B, D — Command sets B and D.** A: **Incorrect:** After cd Docs it creates linux.md in Docs, not Docs/Guides. B: **Correct:** It creates the correct directory, file and expanded report names. C: **Incorrect:** It swaps the file and directory roles and does not expand the report range. D: **Correct:** Its explicit brace list expands to the nine requested report filenames.

Report a correction for Q16

Question 17 MSQ · 3.0 marks

Source diagram or notation
Based on the above data, answer the given subquestions.
Source diagram or notation
6406536345020.Source diagram or notation
6406536345021.Source diagram or notation
6406536345022.Source diagram or notation
6406536345023.Source diagram or notation

Published solution

**1. Move the original:** mv Work/Reports/report1.txt Backup/ removes its old directory entry and places the file in Backup. Reports is now empty in this independent scenario. **2. Remove and list:** A removes the empty directory with rmdir; B removes it with rm -rf. Both then list Backup. **Answer: A, B — Command sets A and B.** A: **Correct:** It moves the file, removes the now-empty directory and lists the destination. B: **Correct:** It achieves the same result using recursive removal on the now-empty directory. C: **Incorrect:** cp leaves the original in Reports, so rmdir fails. D: **Incorrect:** Plain rm refuses a directory without an appropriate directory/recursive option.

Report a correction for Q17