Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 4: Linux Advanced Commands

AWS Cloud

Interview Questions

These questions on Linux advanced commands always come up in DevOps and cloud interviews. With every reply, say the command out loud – the interviewer understands that your hands work on the terminal.

Q1. How do you find the top 10 IP addresses in an Nginx access log?
For a reviewed access log format whose first field is the recorded remote address, use awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -n 10. Check the source and input status. This counts recorded addresses, which can include proxies or shared addresses.
Q2. What is the difference between > and >>? What does 2>&1 do?
> creates or truncates the destination, and >> appends. 2>&1 copies stdout’s current destination onto stderr. Bash applies multiple redirects from left to right.
Q3. How do you check which ports a Linux server is listening on?
ss -ltnp shows listening TCP sockets and visible process details. Use a separate ss -lun query for UDP sockets, and read the local bind addresses.
Q4. What is the difference between service <name> restart and service <name> reload?
restart requests a stop and new start and can interrupt service. reload requests the supported application-specific reload. Verify the documented behavior and actual response for that service.
Q5. What is the difference between service and systemctl?
systemctl is the direct systemd manager interface. A distribution’s service helper can invoke System V init scripts or forward supported actions for some units. Use systemctl for native systemd queries, unit installation and manager reloads.
Q6. Explain the five fields of a cron expression.
The fields are minute, hour, day of month, month and day of week. 30 2 * * 1 describes 02:30 on Mondays in the scheduler’s applicable timezone. Check the implementation when both day fields are restricted.
Q7. How do you see the logs of a systemd service?
Use journalctl -u for the exact system unit and add a boot, time range, or line limit as needed. The display only includes accessible retained logs. An application can also write to separate log files.
Q8. What is the difference between df and du?
df reports mounted filesystem accounting, including the filesystem serving a path. du estimates space used by files it reaches in the selected tree.

Start the interview answer with an observation you can defend

When a Linux question describes an outage or a report, name the exact result the operator needs before giving a command. “List the files in scope,” “count matching recorded addresses,” and “verify the site served the expected response” are different tasks. An interviewer can then see which tool you chose, what input you would give it, and which result would make you change your conclusion. The answers below use fictional workshop scenarios. Practice the short explanation and the follow-up question, then run the small exercise toward the end on your own machine.

A good answer often has four pieces. First, identify the input, account, and scope. Second, say which operation reads that data. Third, say what would count as success. Fourth, name an observation the command cannot establish by itself. If you need a real server-specific value, state that you would check the supported configuration rather than guessing. The goal is to reason aloud from evidence, not to recite a long string of flags.

Questions about selection and text formats

Count the busiest recorded addresses in a web log

The interviewer says, “Show the ten addresses with the most entries in our access log.” First confirm the actual log format. In a reviewed regular format whose first field is the recorded remote address, awk can project that field, sort can put identical values next to each other, uniq can count each adjacent group, and a numeric descending sort can rank the result before head limits the display. This is a count of log entries by the address recorded there. It is not necessarily a count of customers, people, or remote devices. A proxy, shared address, or address rotation can make those concepts differ.

Explain what you will verify: correct input period, readable complete file, field position confirmed, expected counts from a small sample, and the handling of ties. If the first field can be missing, define whether to reject or count those records separately. If multiple log files include the same time range, check for duplicate entries before combining them. Keep the report's source and date in the result, especially if the operator intends to compare days.

Follow-up. Why put sort before uniq?

Uniq works with adjacent repetitions. An input with addresses A, B, A produces three groups of one if no grouping stage precedes it. Sorting puts both A lines together, which allows one group of two. The second sort has a different purpose: it orders the completed counts by numeric frequency. A shared full-size dataset is not needed to demonstrate this behavior.

Find one literal setting without matching a similar string

If the exact text is site=workshop.example.test, say whether the goal is a substring or a complete line. For a complete literal setting the ordinary answer is grep -Fx with a quoted pattern and a known readable file. The shell quotes preserve the argument. The fixed-string flag makes punctuation like periods literal, and the full-line flag constrains the match to the whole record. If configuration allows whitespace around the value, the exact-line rule may be stricter than the real application grammar. Use a documented parser or precise regular expression when that grammar is part of the requirement.

Include a near miss as evidence. A line that substitutes an arbitrary letter for a period can match a regular expression containing an unescaped dot. It should not match the fixed version. Also cover the valid no-match status, distinct from a missing-file error. A check that only displays matching text cannot tell those no-output cases apart without inspecting context and status. If a page reads multiple config snippets, decide which snippets actually apply before expanding the search beyond the known file.

Follow-up. Why does enclosing a pattern in quotes leave regular-expression semantics active?

The quotes are interpreted by the shell and help deliver a single unexpanded argument. Grep separately interprets that argument according to its selected mode. To change the tool's meaning, choose the mode or escape the regular-expression metacharacters using its rules. These are two parsing layers.

Find and safely pass names of several required files

If asked to locate training report files older than a cutoff, start with the approved parent path, expected file type, and a timestamp rule. Quoting '*.log' lets find evaluate the filename pattern inside the traversal. A bare wildcard may be expanded by the caller's current directory first. Use a read-only listing for the first inspection and verify whether a nested mount or symbolic link belongs within the scope. A file's directory name and the authorization to act on its target are different facts.

For a downstream operation, pass the names as arguments through an appropriate find -exec expression or use a compatible zero-byte separator. Splitting a printed list on spaces can turn shift notes.log into two separate path arguments. A newline can occur inside a filename as well. Make the downstream operation fit the reviewed set. A practice answer can inspect files or measure a small known fixture without deleting anything. If the real task is deletion, use the explicit ownership and reviewed retention procedure for that system.

Follow-up. If find prints a path but the file is gone by the next step, what happened?

A traversal observes names at particular moments. Another process can rename, remove, or replace a file before the later command sees it. Check the result of the later operation and use suitable controlled directories or stronger filesystem methods if concurrent changes affect correctness. A preview helps establish intent but does not freeze a live directory.

Explain whether awk's comma split is enough for a spreadsheet export

Start by reading the input format. A simple delimited text file that explicitly forbids commas inside values may work with awk -F,. In CSV with quoted fields, a description like “wash area, south wall” can belong to one field even though it contains a comma. Newlines can also be part of a quoted field in common CSV formats. A plain split on commas and records on newlines does not apply those quoting rules. It can produce records that look plausible but place the desired number in the wrong field.

Use a parser that understands the writer's delimiter and quoting convention, such as Python's standard CSV module for the corresponding dialect, or a documented CSV mode in a supported tool. Verify headers, field count, missing and invalid values, and exact results for a fixture with a quoted delimiter. A command that parses every ordinary-looking sample may still fail on the first complex record in a real export. The goal is to match the data contract, not to require a particular one-liner.

Questions about streams, exit status, and safe outputs

Explain the difference between truncating, appending, and duplicating a descriptor

A Bash command normally starts with stdin on descriptor zero, stdout on one, and stderr on two. A simple greater-than redirection makes the shell open its destination for the command's stdout, generally creating or truncating that file. An append redirection opens so new output goes to the end. Both are choices the shell can make before the command runs. If the command later fails, an output file can still have been created or truncated. If the input and output resolve to the same file, the redirect can erase the input before it is read.

2>&1 copies the current stdout destination onto stderr. Order matters. Starting with stdout on a terminal, > report 2>&1 first opens the report and then sends both streams to that opened destination. With 2>&1 > report, the stderr destination is copied first, so its location remains the original terminal while stdout changes. The copy occurs at that particular step rather than becoming a live relationship. Repeating the same filename with two independent output opens can create separate positions, so the descriptor duplication is important when you need a single mixed transcript.

Follow-up. Does an elevated command make the following redirect elevated?

The caller's shell usually handles the redirect before it launches the program. Changing the credentials of the invoked command does not grant the current shell permission to open the destination. A separate writing utility can open its own paths, subject to its credentials. An authorized edit still needs the right target and procedure, regardless of how you resolve the permission boundary.

Find out whether a zero count is a legitimate output

In a pipeline like a reader feeding a line counter, the counter can successfully see no data because the reader failed to open its source. Bash with its ordinary default often uses the last stage's success as the pipeline result. The visible number zero is then a separate data value, not proof that the source was read. Inspect the diagnostic, the expected input file, and the meaningful stage status. The PIPESTATUS array gives individual statuses in Bash, and pipefail can cause an earlier failing stage to be represented in the combined status. Read those values immediately before another command overwrites the observation.

Checking status needs a defined contract. A grep no-match result often returns one and can indicate a perfectly valid empty selection. A grep error reading the file is a different outcome. A producer cut off early by a consumer designed to stop after a few lines can also report a broken pipe. Decide which commands should consume the full input, which outcomes are valid, and how to inspect the report's content. Pipefail improves modeling of pipeline errors. It cannot establish that a syntactically valid pipeline selected the intended rows.

Follow-up. What fixture would catch the problem?

Try a known source with one match, a valid source with no match, and a missing source. Record the output, the combined and individual statuses, and any diagnostic for each. A reliable pipeline or script should report the missing-source case separately from a valid zero result.

Preserve a good report when generating its replacement fails

Start with a named source and a known-valid report. Write the new output into a separate candidate within the intended destination directory with a unique name and appropriate access. Check the writer's status and compare its structure or known content. Only then promote the candidate using a reviewed operation. On a filesystem supporting normal rename behavior, a successful same-directory rename can atomically replace one named file for later opens. A process already holding the old file open can continue to read it. This arrangement prevents a partially generated file from becoming the new report during an ordinary failed attempt.

Explain the boundaries. The destination must be the separate approved path, the candidate's permissions must suit the reader, and concurrent writers need an ordering or locking policy if their timing matters. A rename does not combine changes in several files or databases into one transaction. A crash-resistant design can require additional durability steps beyond a rename. For an interview demonstration, use a private scratch directory and show that a known malformed input returns a documented failure while the previous report still matches its expected bytes. That is stronger than finding a file with the old name and hoping it survived.

Questions about services and connectivity

Explain an enabled service that is currently inactive

Runtime activity and enablement represent different facts. systemctl is-active asks whether the selected unit is active now. systemctl is-enabled describes aspects of the unit's installation state, such as links to targets for a regular installed service. A manual stop can leave an enabled service inactive. A failed startup can leave it enabled and failed. A disabled service can be active because an operator started it or another unit activated it. A good answer asks how it was activated and what the required state actually is.

When analyzing a systemd unit, inspect LoadState, ActiveState, SubState, and relevant result fields. An active oneshot with substate exited can be applying exactly the type of completion it was configured to retain. An unknown unit calls for checking the name and correct manager, rather than starting a service that happened to have a similar label. A connection error from the client asks whether it can contact the manager at all. Classify those cases before choosing a restart or an enable action.

Follow-up. Does the service wrapper always use systemctl on Linux?

Only the installed wrapper and operating system determine how it handles an action. Some wrappers can run System V init scripts, and some forward supported operations for certain units. A direct systemctl query is appropriate for a systemd host, while the documentation of the local wrapper tells you what it supports. A missing wrapper does not imply a missing service manager.

Choose how to apply a service change

First identify which configuration was edited. Systemd unit definitions are read by the manager. An application such as Nginx reads its own settings. A daemon reload refreshes the manager's unit definitions and does not by itself restart a service or apply the application's separate config. An application reload uses its documented unit or control mechanism, if supported. A restart stops and starts the service, which can introduce interruption and can fail during startup. Choose based on the changed file, the supported control operation, and the required service behavior.

For an approved Nginx change, preserve the relevant original files and verify that the configuration test reads the same installation and path that will be used by the service. Read the successful or failed result before requesting a reload. Then verify the exact site response. Nginx can perform a graceful configuration change with workers finishing current requests when the change succeeds. That is specific to the service mechanism. Do not promise that a generic reload for any wrapper or software guarantees every connection survives. A configuration syntactically accepted by the service can still select an undesired route.

Follow-up. Where would you look for the first attempt's failure?

On a systemd host check the exact unit's state and a bounded journal view for the applicable boot and time. Some applications write additional logs outside the journal. Match the timestamp, source, and unit, and retain the earlier cause rather than only the final result line. If the account cannot read those logs, state that missing evidence.

Identify a local listener and explain why it may not be reachable

Use a command such as ss -ltnp on a Linux host to inspect listening TCP endpoints and available process details. Read the local address and port, not only the presence of a number. A row bound to 127.0.0.1 is an IPv4 loopback endpoint in that network context. An externally addressed packet cannot reach it directly, even if a network rule permits the port. A wildcard address covers applicable local interfaces, and a listener can also bind a particular non-loopback address. Whether a remote client reaches one requires its actual route and the network and host controls along the path.

In a reverse proxy layout, the backend can intentionally listen on loopback and still serve remote users indirectly. Test the known backend route locally, then the actual public front-end name and path from an approved point. An HTTP status of 404 is evidence an HTTP responder answered that request, but the wrong virtual host or an upstream choice could have produced it. A timeout supplies different evidence. State whether your test was a socket listing, a TCP connect, or an application request, and use the correct method and response content for the user's problem.

Follow-up. What does a failed ping contribute to this diagnosis?

It says the chosen ICMP echo test received no expected response. ICMP and TCP have different processing and policy. A failed echo does not establish whether an HTTPS route responds. Use the intended application protocol on the authorized endpoint and inspect the relevant network setup rather than opening unnecessary traffic for the echo test.

Distinguish a host key change from a rejected login key

During SSH the client verifies the remote server's public host identity. A fingerprint mismatch asks whether the name or address now points to a different machine or whether an approved key change occurred. Obtain trustworthy independent confirmation before changing the stored host record. User authentication happens separately. A public-key rejection can mean the wrong username or selected local key does not correspond to the authorization on that host. Confirm the intended account and identity configuration. Keep private key material local and out of logs.

If a transfer works but the live page is unchanged, verify what operation was performed. A copy into an account's home directory stages data there, while an application might read a different document root. Separate a verified transfer from an approved activation step. A download back to a different local filename or a remote check value can demonstrate file equality. A particular request verifies the application is serving the result. Every one of these tests has a defined scope.

Explain why a name can fail when a request to one address works

Ask which name and which source of lookup information the client used. A DNS query can show what one resolver returned for a requested record type. The application can use an operating-system lookup, local overrides, caches, a proxy, or its own resolution mechanism. A successful address-based test also changes what is in the HTTP host field if the URL itself used the literal address. Applications that serve several sites from one endpoint can use the host name to select a site. With HTTPS the certificate and the TLS server-name negotiation can depend on the intended name as well.

A precise follow-up test uses an approved client method that keeps the same hostname and path while selecting a known authorized endpoint. Curl's one-invocation resolution override can do that for a direct connection. It changes where this one client connects without changing the public DNS result and can preserve ordinary hostname validation for HTTPS. Compare the outcome with a request that uses normal resolution and retain the exact method and expected content. A match with the override suggests which boundary to inspect, but it does not show how all other clients resolve or route their requests.

For an interview use evidence from a practice setup or describe the observations you would request without contacting an unapproved system. A DNS response address, a TCP destination, a TLS peer identity, and an HTTP response come from different stages. If two of them differ, identify the first divergence rather than recommending an immediate change to every stage. The handover needs an observation a second operator can trace to the intended host.

Questions about storage, archives, and restore evidence

Reconcile a filesystem's used space with a small visible directory total

Begin with the exact path the application wrote. df reports storage as seen by the mounted filesystem serving that path. du walks names and estimates file space usage in a chosen tree. Their scopes differ. A partial du walk only describes what it reached. It can omit directories your account cannot read, filesystem metadata, and storage no longer linked by a visible name. Other mounts and filesystem features can also influence the comparison. Read findmnt --target to identify the backing mount, and check whether the scan crossed any separate filesystems.

Suppose an operator removed an old log and the visible directory size dropped but filesystem availability did not change. Ask whether the writer still holds that log open. Unix can remove the last pathname while the open handle keeps the object alive. Use an authorized narrow open-file investigation and the application's supported rotation or reopen procedure. A filesystem snapshot or shared data can also keep bytes retained. The difference is a question to investigate, and it does not justify deleting unrelated files until a number improves.

Follow-up. How can a sparse file be a gigabyte in a listing and much smaller in du?

A logical size can include regions that read as zeros without independently allocated data blocks. Du normally estimates allocation, and the file length includes those holes. Compare both when the question concerns apparent data length versus consumed storage.

Identify the missing step after a block device gets larger

If an EBS volume or other block device grows, check the actual device and filesystem layout before doing another write. lsblk can display the device size and its partition or logical relationships. findmnt maps an application path to a mount and source, and df shows the filesystem's current capacity. If the device is larger and the mounted filesystem is unchanged, a partition, logical volume or filesystem may still need to be extended according to the platform's procedure. Some filesystems live directly on the device and have no partition step. The observed layout decides which part applies.

A safe answer starts by identifying the correct volume, its format, and a reviewed snapshot or backup plan. It then directs the operator to the service documentation for the actual type and intermediate layers. Formatting creates a filesystem and can remove access to the old data. It is not an ordinary response to a volume-size mismatch. After approved work, verify the expected block sizes, mount source, filesystem space and application access. Use the original observed values so the comparison shows what changed.

Follow-up. How do you detect a missing data mount when the directory still exists?

Query the exact mount point, and query the filesystem that currently serves the directory. A path can exist under the root filesystem while the expected separate mount is absent. Compare the actual selected source, not only the directory name or one entry in fstab.

Demonstrate that a compressed archive is a useful backup

Archiving packages member names and content, and a tar file can hold directories and files with relative paths. Gzip can compress that resulting stream. A snapshot or tarball has a known capture scope. Before calling it a usable backup, identify the data the recovery needs, such as a particular document root, its config, and any separate data stores. The existence of a compressed file confirms very little about which of those items it contains. Check the member listing, verify an independent record of the expected state, and perform a test restore to a new empty location.

For a concrete answer, say that the required paths are site/index.txt and site/assets/worksheet.txt. Show how restoring them under an isolated directory and using a byte comparison against known original content tests those two members. A built-in format integrity test confirms a different property. A perfectly valid archive can contain last week's files or the other site's directory. When permissions, ownership or metadata are part of the restore requirement, test those too. The application should be tested under the intended environment before trusting it as recoverable.

Questions about scheduling, environments, and performance

Read a cron schedule that restricts both day fields

State what each position means: minute, hour, day of month, month, and day of week. For the ordinary example 30 2 * * 1, that is 02:30 on Mondays in the scheduler's applicable timezone. A fixed time does not identify the timezone automatically. If an expected time is 01:30 Monday in India and the scheduler's clock is UTC, the equivalent is 20:00 Sunday UTC. Include that date shift, especially when a weekday restriction is present.

Cronie can run a line with both day-of-month and day-of-week restricted when either day field matches, along with the remaining requirements. Thus 0 8 1 * 1 generally means the first day of a month and all Mondays at 08:00, not only the first Monday. When the requirement is narrower, one approach is to choose the relevant weekday in the table and check the first seven dates inside a reviewed script. Test a calendar containing a first day that is not a Monday and one where it is. Confirm the implementation rather than assuming the same grammar applies to all schedulers.

Follow-up. Does a syntax check prove that the job will deliver its result?

A syntax check verifies part of the table contract. The daemon still needs to load and schedule the job, the expected account needs access, and the command needs to finish correctly. Verify each with a bounded log or artifact observation. A machine being off at a scheduled time is a separate behavior to address in the scheduling design.

Diagnose a working manual command that fails under a schedule

Compare the exact account, interpreter, working directory, inputs, outputs, and environment. The interactive shell can already have a path or variable set by its startup files. A scheduler can supply different defaults. Run the actual script against a known fixture with a small explicit environment to detect assumptions, then check the intended scheduled environment. A newly created log with a missing-file message is evidence that the launch happened, while the work failed. No log might mean the scheduler did not attempt it or the shell could not open its output path. Inspect both boundaries.

In a Cronie table, a percent sign inside command text can be interpreted by cron before a shell sees that text. Putting a complex date format in the external script avoids that table-level parse. Full paths and a documented command search list help separate a command-not-found result from an input problem. If a whole script runs under sh while its actual syntax is Bash-specific, the correct fix is to select a compatible interpreter or change the script's language deliberately. Test the normal invocation again after the change.

Follow-up. Why didn't setting the value in an unrelated terminal fix the running service?

Exported values are passed to new processes launched with that environment. A service manager generally supplies its own configured launch environment. Identify its actual config source and how the installed service takes changes. Editing a login profile does not rewrite the environment of an existing process.

Interpret one process's CPU percentage alongside host load

Ask what value and denominator the interviewer is describing. In a per-CPU task view a single CPU-bound thread can approach 100 percent. On a guest with four logical CPUs that one thread contributes roughly 25 percent of total capacity in a sustained interval if the other CPUs are idle. An application can still wait for its one thread to finish. A task's CPU time and its wall duration are different measurements. If a file wait takes ten seconds of elapsed time and the process executes briefly, there may be little accumulated CPU time even when the request was slow.

Linux load averages summarize runnable and uninterruptible demand over several time windows. They are not CPU percentages or an exact diagnosis of a slow disk. A short-term rise can reflect something different from a sustained high long-term average. Compare the relevant CPU count and policy, busy or blocked tasks, and measurements during the affected request. A quota, one busy execution thread, or a different scheduling context can explain why a machine with spare aggregate capacity still has a slow task.

Follow-up. Does a raised iowait percentage tell you which disk is slow?

No. It is a clue derived from CPU time accounting for conditions associated with I/O, with documented limitations. Identify the waiting tasks and check the devices or paths they use over the same period. The operator may need per-device latency or other application evidence instead of a generic diagnosis.

Interpret low free memory without assuming a leak

Linux uses memory for caches and other data that can sometimes be reclaimed. free distinguishes unused memory from its estimate of memory available for new applications without swapping. A single small free value can coexist with substantial estimated available memory. Inspect time trends and the actual context. A process container can have its own limit. A reported used-swap amount can reflect earlier activity, so compare current paging and memory pressure when diagnosing a delay.

For a single application process, resident memory and virtual size are also different. Virtual space can include pages not resident or data shared with other processes. Adding all resident sizes as though every process owns its pages exclusively can overstate total physical usage. To look for a leak, over time across similar workloads, measure the relevant process or application memory accounting and compare after expected release points. One screenshot tells you which process values were visible in that interval and is not a complete lifecycle study.

Rehearse one interview explanation with actual results

Choose the access log question and demonstrate the report without needing a running Nginx server. This fixture defines its first whitespace-separated field as the recorded address. Later fields represent the status and path. The addresses are reserved for documentation. They do not refer to machines you should contact. Use Bash and the usual text tools from a practice terminal, and keep the output private to this lesson directory. Predict that the busiest address will have two entries and the second address one entry.

answer_lab=$(mktemp -d) || exit 1
printf 'Lab directory: %s\n' "$answer_lab"
cat > "$answer_lab/access.sample" <<'LOG'
192.0.2.10 200 /health
192.0.2.11 200 /worksheet
192.0.2.10 404 /old-page
LOG
(
  set -o pipefail
  awk '{ print $1 }' "$answer_lab/access.sample" | LC_ALL=C sort \
    | uniq -c | LC_ALL=C sort -rn | awk '{ print $1, $2 }'
) > "$answer_lab/tally.txt" && cat "$answer_lab/tally.txt"
2 192.0.2.10
1 192.0.2.11

The directory line varies and is omitted. This sample is deliberately not the full Nginx combined log format. Its columns are defined explicitly for the exercise. It also counts a 404 request, because the operator asked for all logged entries. If the question instead asks for successful requests only, change the known fixture's filter to require a specific status or documented class and update your prediction. The count depends on the exact question about the source data.

Now show that a missing source invalidates the inference. Capture diagnostics separately from the numeric count. This intentionally runs a command that fails and stores the observed combined and stage statuses immediately. Read the two reports together. If a shell is configured to abort on unhandled failures, use a fresh Bash with its usual interactive settings or keep the expected failing pipeline in an explicit branch.

(
  set +o pipefail
  cat "$answer_lab/absent.sample" 2> "$answer_lab/error.txt" | wc -l
  printf 'default status=%s stages=%s\n' "$?" "${PIPESTATUS[*]}"
  set -o pipefail
  cat "$answer_lab/absent.sample" 2> "$answer_lab/error.txt" | wc -l
  printf 'pipefail status=%s stages=%s\n' "$?" "${PIPESTATUS[*]}"
)
cat "$answer_lab/error.txt"
0
default status=0 stages=1 0
0
pipefail status=1 stages=1 0

The diagnostic describes the missing path, with wording dependent on the platform. The count zero still appears with pipefail enabled because wc sees no data. The change is that the earlier failure is visible in the combined status. A useful spoken answer is “A counter can correctly report zero for the stream it received while a reader failed. I would check the reader and reject the report before using that count.” You can demonstrate the distinction without touching any production log or network endpoint.

For follow-up practice, add a fourth sample row with a new status but the second recorded address. Before running the commands, predict two entries for each listed address. Explain that ranking equal counts can require a stated tie policy, especially if exactly ten lines are required. Then filter by one status code and describe the new request semantics. A fixed fixture with small integers lets the reviewer check your logic independently.

When your notes are complete, clean up the exact files created for the drill. Check the directory name first. If you saved your own expected-output files under that directory, remove them separately after reviewing their names. The rmdir command requires the directory to be empty, which keeps unknown artifacts available for inspection.

if [ -n "${answer_lab:-}" ] && [ -d "$answer_lab" ]; then
  rm -- "$answer_lab/access.sample" "$answer_lab/tally.txt" "$answer_lab/error.txt"
  rmdir -- "$answer_lab"
fi
unset answer_lab

Check the evidence before giving a short answer

Quiz. One named path read from df shows 90 percent usage. Which conclusion follows?

The filesystem serving that path reported that usage in the observation. You still need to locate the data responsible and measure the writer's actual requirements. A different mount's space, a directory scan's size, and a whole device's capacity are different evidence.

Quiz. A host has a working local HTTP response and the public site still fails. What should you compare?

Compare the actual client hostname, address, port, method, and path with the tested local endpoint. Read the intended proxy and network path evidence. A working backend response establishes one important boundary but leaves the public request unverified.

Quiz. The new report passed a parse check. Which additional test verifies the intended change?

Compare the expected actual contents or application response against a known fixture, and inspect the scope of changes. A parse check can accept a valid configuration or report that still refers to the wrong input, host, or date.

Name the input first

Identify the file format, real path, account and scope. An exact observation needs those details before tool flags become meaningful.

Describe the failure case

State which diagnostic or status would change the conclusion. Demonstrate that outcome on a separate fixture.

Verify the user's actual result

Inspect the responsible process or file, then check the observed application result, relevant contents, and scope after the change.

Primary references