Linux and Logs for QA: What They Actually Ask in Interviews
'The service returned a 500, check the logs' — half of a tester's working days start with that sentence. I've covered everything you need for it: ssh, moving around, tail -f, grep, pipes, reading a stack trace and finding the cause when a service doesn't answer. With real command output and interview tasks.
- The tester presses the button: grep starts searching the log for ERROR.
- The log runs through grep: lines without ERROR are thrown away.
- ERROR lines drop out of the bottom: grep prints only lines that match.
- He picks one up and lifts it: the line to study and attach to the bug report.
Everything QA needs to be able to do in the terminal — from your first ssh to finding the cause of a bug in the logs, with real tasks

Why Does QA Need the Terminal and Logs?
Because the screen only says “Something went wrong”. What exactly went wrong is written in the logs.
A typical situation. A tester places an order on a test environment and gets an error. They file a bug: “Can’t place an order, error 500”. The developer tries it — works for them. The bug comes back marked “cannot reproduce”. Two days of back-and-forth.
Now the same story, but the tester logged in to the server and found one line in the log: payment-service returned 400: amount must be greater than 0. The cause is clear right away: a cart with a zero total. The bug gets fixed the same day.
QA needs the terminal and logs for four things:
| # | Why | Example |
|---|---|---|
| 1 | Work on test servers | Environments almost always run Linux, and there’s no graphical interface there |
| 2 | Find out why it failed | The UI shows “Error”, the log shows the class, the line of code and the cause |
| 3 | Write bug reports that get fixed fast | A time, a request id and a log line instead of “doesn’t work” |
| 4 | Understand whose bug it is | Did our service fail, the one next to it, the database — or did the disk just fill up? |
The good news: you don’t need many commands. About fifteen of them cover almost all the daily work.
What Are the Terminal and a Log (in Plain Words)
Picture an airplane. While the flight goes normally, the passengers know nothing about what’s happening in the cockpit. But the flight recorder — the “black box” — is writing down every action and every reading the whole time. If something happens, it’s the first thing people reach for.
A log is the same kind of recorder for a program. A service keeps writing to a file what it’s doing: a request came in, it went to the database, it responded, it crashed. And the terminal is the way to get to those records and quickly find what you need in them.
Three key concepts:
- Shell — the program that takes your commands as text and runs them. Most often it’s
bash. The window you type them into is called a terminal. - Log — a text file a program appends events to, in order: one line — one event.
- Pipe — the
|character, which passes the output of one command to the input of another. Simple commands get assembled into a complex search.
All the examples below were run on a small sample log of an online shop. The command output is real — you’ll see exactly what you would see on your own machine.
Connecting to a Server: ssh
ssh is a way to open a terminal on a remote machine. You type commands on your side, and they run on the server.
ssh qa@staging.example.com
# log in with a key instead of a password
ssh -i ~/.ssh/id_ed25519 qa@staging.example.com
# non-standard port (the default is 22)
ssh -p 2222 qa@staging.example.com
# download a log from the server into your current folder
scp qa@staging.example.com:/var/log/shop/app.log .
Here qa is the user name on the server and staging.example.com is the address. On the first connection ssh will ask whether you trust this server — answer yes. To leave the server, use the exit command. Access is usually given by key: it’s a pair of files, the private one stays with you, the public one is put on the server. You never send the private key to anyone — not in a chat, not in a bug report.
Moving Around and Looking at Files
Seven commands you can’t do anything on a server without:
| Command | What it does |
|---|---|
pwd |
Show which folder you’re in right now |
ls -la |
List files: with permissions, size, date and hidden files |
cd /var/log |
Go to a folder. cd .. — one level up, cd - — back to the previous one |
cat file |
Print the whole file. For small files only |
less file |
Open a file for reading, with scrolling and search |
head -n 20 file |
The first 20 lines |
tail -n 20 file |
The last 20 lines |
Fresh events sit at the end of a log, so you need tail more often than head. For big files — only less. It doesn’t load the whole file into memory and opens even a log of several gigabytes. Keys inside less: Space and b — a page forward and back, G and g — to the end and to the start of the file, /text — search forward, ?text — search backward, n — next match, q — quit. And the Tab key in the shell completes a file or folder name for you.
tail -f: Watching a Log Live
The most useful trick for a tester. tail -f doesn’t exit — it waits and prints new lines as the service writes them.
tail -f logs/app.log
# if the log is written fast — filter the stream right away
tail -f logs/app.log | grep ERROR
The routine goes like this: you open a terminal with tail -f, reproduce the bug in the browser next to it — and exactly the lines that belong to your action show up in the terminal. No need to search by time and guess which of a thousand lines is yours. To stop — Ctrl+C.
There’s also the tail -F variant (with a capital letter). It keeps following even if the log file has been replaced with a new one — that happens during rotation, when the old log is renamed to app.log.1 and a clean app.log is started.
How to Read a Log Line
2026-11-10 14:02:11.498 ERROR [req-7f3a9c] OrderService - Failed to create order for user=58
| Part | What it is | In the example |
|---|---|---|
| Timestamp | When the event happened, down to the millisecond | 2026-11-10 14:02:11.498 |
| Level | How serious it is | ERROR |
| Request id | The identifier of the request, shared by all the lines of one request | req-7f3a9c |
| Source | The class or module that wrote the line | OrderService |
| Message | What happened | Failed to create order for user=58 |
Every project has its own format, but these parts are almost always there. A request id is also called a trace id or a correlation id — the meaning is the same. One thing to remember about the time: on servers it’s often in UTC, not in your time zone. The bug happened at 19:02 for you, and in the log it’s 14:02. The date command on the server shows its current time and zone.
Log levels:
| Level | What it means | Example |
|---|---|---|
DEBUG |
Details for the developer. Usually turned off in production | Cart loaded: cart=990 total=0.00 |
INFO |
Normal course of work | POST /api/orders user=42 status=201 |
WARN |
Still working, but something looks suspicious | Connection pool usage 85% (17/20) |
ERROR |
The operation failed, the service keeps running | Failed to create order for user=58 |
FATAL |
The service can’t go on and stops | Couldn’t connect to the database at startup |
The levels go in increasing order of importance. If the configuration says INFO, then DEBUG doesn’t get into the log at all. That’s why on a test environment the level is often lowered to DEBUG — you see more. And WARN is worth reading carefully. A warning about a full connection pool a minute before a crash — that is the cause.
grep: Searching a Log
grep prints the lines that contain the given text. It’s the main tool for working with logs.
grep ERROR logs/app.log
2026-11-10 14:02:11.498 ERROR [req-7f3a9c] OrderService - Failed to create order for user=58
2026-11-10 14:02:19.660 ERROR [req-e1f2a3] PaymentClient - Timeout after 5000ms calling payment-service
2026-11-10 14:02:27.903 ERROR [req-9a8b7c] PaymentClient - Timeout after 5000ms calling payment-service
2026-11-10 14:02:36.782 ERROR [req-5e6f7a] PaymentClient - Timeout after 5000ms calling payment-service
2026-11-10 14:02:44.031 ERROR [req-3f4a5b] OrderService - Failed to create order for user=64
The flags you need to know:
| Flag | What it does |
|---|---|
-i |
Ignore case: error, Error, ERROR |
-n |
Show the line number |
-v |
The opposite: lines that don’t contain the text |
-c |
Print the number of lines instead of the lines |
-r |
Search all files in a folder and its subfolders |
-A 5 |
Plus 5 lines after the match (After) |
-B 5 |
Plus 5 lines before the match (Before) |
-C 5 |
Plus 5 lines on both sides (Context) |
-E |
Extended regular expressions: “or”, groups (…), repetitions {n} |
-i — case. grep is case-sensitive. An old module writes error in lowercase — and a plain search misses it. grep -c ERROR logs/app.log answers 5, while grep -ic error logs/app.log answers 6. The sixth line is the one you wouldn’t have seen without -i. Note: -c counts lines, not matches.
-n — line numbers. Handy for opening the file at the right place later or for referring to it in a bug report:
grep -n "status=500" logs/app.log
19:2026-11-10 14:02:11.502 INFO [req-7f3a9c] OrderController - POST /api/orders user=58 status=500 time=272ms
31:2026-11-10 14:02:44.035 INFO [req-3f4a5b] OrderController - POST /api/orders user=64 status=500 time=198ms
Notice: the 500 response is logged at the INFO level. A search for the word ERROR alone won’t find these lines.
-v — exclude. Remove the noise and keep what’s interesting. For example, all POST /api/orders that didn’t end in success: grep "POST /api/orders" logs/app.log | grep "status=" | grep -v "status=201". Five lines remain in the output: two 500 responses and three 504.
-A, -B, -C — context. A single line with an error rarely explains everything. What came before it?
grep -B 3 "Failed to create order for user=58" logs/app.log
The three lines before the error already show something suspicious: Cart loaded: cart=990 total=0.00. And -A shows what comes after the error — usually a stack trace, more on that below.
-E — several options at once. grep -E "status=(500|504)" logs/app.log finds the responses with code 500 or 504 — the same five lines. And the pattern "time=[0-9]{4,}ms" finds requests that took longer than a second: four digits or more in time=.
-r — across all files. For when you don’t know which log to search: grep -rn "Rejected" logs/. Before each line grep shows the file name and, thanks to -n, the line number — logs/payment.log:4:…. The main use of -r is searching by request id, we’ll get to it a bit further down.
Pipes: Chaining Commands Together
The | character passes the output of the command on the left to the input of the command on the right. Each command does one simple thing, and together they answer complex questions. These are the ones put into a chain most often:
| Command | What it does |
|---|---|
wc -l |
Counts lines |
sort |
Sorts lines. -n — as numbers, -r — in reverse order |
uniq -c |
Collapses identical adjacent lines and writes how many there were |
awk '{print $N}' |
Prints the Nth column, the separator is any number of spaces |
cut -d' ' -f N |
Prints the Nth field, the separator is exactly one given character |
The simplest thing is to count: grep -E "WARN|ERROR" logs/app.log | wc -l answers 7.
Which error is the most frequent? This is a classic chain, worth memorizing as a whole:
grep ' ERROR ' logs/app.log | cut -d' ' -f7- | sort | uniq -c | sort -rn
3 Timeout after 5000ms calling payment-service
1 Failed to create order for user=64
1 Failed to create order for user=58
Step by step:
grep ' ERROR '— kept only the lines with errors.cut -d' ' -f7-— cut off the time, level, request id and class, kept the message text (from the 7th field to the end).sort— put identical messages next to each other. Without this stepuniqwon’t work: it only collapses adjacent lines.uniq -c— counted the repeats.sort -rn— sorted by the number, from largest to smallest.
Conclusion: the main problem is timeouts when calling the payment service.
Columns with awk. awk splits a line on spaces and numbers the parts: $1, $2, $3… The fifth column in our log is the class. Let’s replace cut in the chain with awk '{print $5}' and find out who writes errors more often:
grep ERROR logs/app.log | awk '{print $5}' | sort | uniq -c | sort -rn
3 PaymentClient
2 OrderService
The catch: the log also contains stack trace lines, which have neither a time nor a level — they’ll add junk to a summary by columns. To keep only the lines that start with a date, put grep -E '^2026' at the start of the chain (^ means the start of a line).
awk or cut? In our log there are two spaces after INFO — for alignment. awk treats them as one separator, while cut -d' ' treats them as two, and the fields shift. That’s why awk is more reliable for logs. cut is good where the separator is strictly one: CSV files, /etc/passwd.
How to Read a Stack Trace
A stack trace is a chain of calls: which function called which at the moment of the error. It looks scary, but you only need to read three places. Let’s take the error and the eight lines after it:
grep -A 8 "Failed to create order for user=58" logs/app.log
2026-11-10 14:02:11.498 ERROR [req-7f3a9c] OrderService - Failed to create order for user=58
com.shop.order.OrderException: Payment was not completed
at com.shop.order.OrderService.create(OrderService.java:87)
at com.shop.order.OrderController.createOrder(OrderController.java:42)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:897)
Caused by: com.shop.payment.PaymentException: payment-service returned 400: amount must be greater than 0
at com.shop.payment.PaymentClient.charge(PaymentClient.java:55)
at com.shop.order.OrderService.create(OrderService.java:81)
... 2 more
| Where to look | What’s there | In the example |
|---|---|---|
| The first line | The error type and message — what the service saw | OrderException: Payment was not completed |
The last Caused by |
The original cause. There can be several — you need the bottom one | payment-service returned 400: amount must be greater than 0 |
The first at line with your own code |
Where exactly it failed: the file and line number | PaymentClient.java:55 |
“Your own code” is your project’s package, here com.shop. Lines with org.springframework or java.base are the framework and the standard library. There can be fifty of them in a row, and you can skip them. And the first line says “payment was not completed” — that’s the consequence. The cause is lower, in Caused by: the payment service rejected an amount of 0. Someone who read only the top will file the bug against the wrong team.
In Python the order is reversed: a traceback starts with the words Traceback (most recent call last), and the error itself is on the very last line. Read it from the bottom up. In a bug report the stack trace is attached in full and as text, not as a screenshot.
One Request Across Several Services
An order goes through several services: the orders API, payments, notifications. Each has its own log. To connect lines from different files, the first service gives the request an identifier and passes it on — usually in an HTTP header like X-Request-Id. Every service writes it into every one of its lines.
We take the id from the line with the error and search all the logs at once:
grep -rh "req-7f3a9c" logs/ | sort
2026-11-10 14:02:11.230 INFO [req-7f3a9c] OrderController - POST /api/orders user=58 items=1
2026-11-10 14:02:11.236 DEBUG [req-7f3a9c] CartService - Cart loaded: cart=990 total=0.00
2026-11-10 14:02:11.301 INFO [req-7f3a9c] PaymentClient - Calling payment-service amount=0.00
2026-11-10 14:02:11.320 INFO [req-7f3a9c] ChargeController - POST /charge amount=0.00 currency=USD
2026-11-10 14:02:11.324 WARN [req-7f3a9c] ChargeValidator - Rejected: amount must be greater than 0
2026-11-10 14:02:11.326 INFO [req-7f3a9c] ChargeController - POST /charge status=400 time=6ms
2026-11-10 14:02:11.498 ERROR [req-7f3a9c] OrderService - Failed to create order for user=58
2026-11-10 14:02:11.502 INFO [req-7f3a9c] OrderController - POST /api/orders user=58 status=500 time=272ms
The -h flag removes the file names from the output, and sort puts the lines in time order — a line starts with the date, so a plain sort works as a chronological one. Now the whole story of the request over 272 milliseconds is visible: a cart with a total of 0.00 → the order service went to payments anyway → payments honestly answered 400 → the order service turned that into a 500.
The bug report writes itself: “POST /api/orders with a cart totalling 0 returns 500 instead of a 4xx validation error. Request id req-7f3a9c, 2026-11-10 14:02:11 UTC”. Why a 500 on user input is always a bug is covered in the article on API testing.
The timeouts open up the same way. A search for req-e1f2a3 shows: the order service waits for payments for 5 seconds and answers 504, while the payment service waits for the bank for five more seconds and only then writes its own error. The timeouts aren’t aligned — that’s a separate question for the team.
The Service Doesn’t Answer: Processes, Ports, Disk, Memory
The page doesn’t open, the API is silent. Before writing “the environment is down”, check five things. It takes a minute.
1. Does the service answer from the inside? A request from the server itself, bypassing the proxy and the network. curl is covered in detail in the article on APIs, here only the result matters:
curl -i http://localhost:8080/health
curl: (7) Failed to connect to localhost port 8080 after 0 ms: Couldn't connect to server
The port and the check address (/health) are different in every project — ask the team. What the result means:
| What curl returned | What it means |
|---|---|
200 OK from inside, but an error from outside |
The service is alive. The problem is in front of it: nginx, the load balancer, the network |
Failed to connect / Connection refused |
Nothing is listening on that port: the service isn’t running or has crashed |
| The request hangs until the timeout | The service is running but stuck — or the port is closed by a firewall |
500, 503 |
The service is running and reports the error itself — go to its log |
2. Is the process running?
ps aux | grep java
# if the service is run by systemd
systemctl status shop-api
ps aux prints all the processes on the machine, grep keeps the one you need. The output has the user, the PID (process number), the share of CPU and memory, and the launch command. top shows the load live, and htop is the same thing but easier to read (it may not be installed on the server). A process that has taken 100% of the CPU or all the memory is visible right away. To exit — q.
3. Is it listening on the port?
ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=812,fd=6))
LISTEN 0 100 *:8080 *:* users:(("java",pid=1432,fd=45))
This is an example of output from a test server. The flags: -t — TCP, -l — listening ports only, -n — port numbers instead of names, -p — which process. To see other users’ processes you need sudo. You can also find out who took a specific port like this: sudo lsof -i :8080. A common case: the service won’t start, with the error Address already in use — the port is held by an old instance that didn’t exit.
4. Is there disk space? The command is df -h. If the Use% column says 100% — the cause is found. The service can’t write to the log, to the database or to a temporary file, and fails with the error No space left on device. On test environments the disk is usually filled up by the logs themselves.
5. Is there enough memory? The command is free -h. Look at the available column, not free: Linux uses free memory for cache and gives it back on demand. If available is near zero, the system starts killing processes itself — in the system log you can see it by the words Out of memory.
Stopping a process:
kill 1432 # politely: asks the process to exit (the SIGTERM signal)
kill -9 1432 # hard: kills it immediately (the SIGKILL signal)
Start with a plain kill: the process gets time to close connections and finish writing files. kill -9 is for when the process doesn’t react. And if the service is managed by systemd, sudo systemctl restart shop-api is the right way. And in any case — only on a test environment and after warning the team.
File Permissions: Where Permission denied Comes From
Every line of ls -l starts with something like -rw-r-----. Those are the file’s permissions.
-rw-r----- 1 shop adm 2963 Nov 10 14:02 app.log
The first character is the type (- a file, d a folder). Then come three triplets:
| Triplet | For whom | In the example |
|---|---|---|
rw- |
The file’s owner (shop) |
Read and write |
r-- |
The group (adm) |
Read only |
--- |
Everyone else | Nothing |
The letters: r — read, w — write, x — execute. For a folder, x means the right to enter it.
You connected as the user qa. You’re not the owner and not in the adm group — so you’re “everyone else”, and cat app.log answers Permission denied. What to do:
sudo cat app.log— run the command as the administrator, if you’ve been givensudo- ask to be added to the right group — that’s the proper long-term solution
The second common case — a script won’t run: ./count_errors.sh answers Permission denied. The file doesn’t have the x permission. chmod +x count_errors.sh adds it — after that ls -l shows -rwxr-xr-x. Permissions are also written as digits: r = 4, w = 2, x = 1, summed for each triplet. chmod 644 file is rw-r--r--, chmod 755 file is rwxr-xr-x.
What not to do: chmod 777. That’s “everyone can do everything”, and in an interview that answer to the question about Permission denied counts as a mistake.
Where Logs Live: /var/log and journalctl
There’s no single place, but it’s worth looking in this order:
| Where | What’s there |
|---|---|
/var/log/ |
System logs and the logs of most programs |
/var/log/syslog or /var/log/messages |
The general system log (Debian/Ubuntu or RHEL/CentOS) |
/var/log/nginx/access.log |
All HTTP requests that went through nginx |
/var/log/nginx/error.log |
nginx errors: couldn’t reach the service, timeout |
/var/log/<service name>/ |
Application logs — a common option, but not a mandatory one |
journalctl |
Logs of services run by systemd |
The easiest way to get the exact path to the application log is to ask the developers or DevOps — and write it down. Old logs sit next to it after rotation: app.log.1, app.log.2.gz. You don’t need to unpack the compressed files — there’s zgrep for them, which works like grep.
Many services don’t write to a file at all and hand their logs to the system — systemd. journalctl reads them:
# logs of one service live, the equivalent of tail -f
journalctl -u shop-api -f
# the last 100 lines
journalctl -u shop-api -n 100
# for the last 10 minutes
journalctl -u shop-api --since "10 min ago"
# errors and above only
journalctl -u shop-api -p err
Here -u is the service name (unit). The output of journalctl is piped into grep the same way.
If the service runs in a container, its logs are viewed with docker logs — there’s a section about it in the article on Docker.
DevTools: the Frontend’s Logs
The frontend has its own logs, and they live in the browser. F12 — and you have the two tabs you need.
| Tab | What to look at |
|---|---|
| Console | Red lines are JavaScript errors. For example, Uncaught TypeError: Cannot read properties of undefined |
| Network | All the page’s requests: address, method, status code, time, request and response body |
What’s worth turning on and knowing:
- Preserve log — it’s on the Network tab and in the Console settings. Without this checkbox the records disappear when you go to another page, and the bug is often right there.
- The Fetch/XHR filter on the Network tab — keeps only the API requests, without images and styles.
- Response headers. Look for
X-Request-Idor something similar there: that’s the very id you’ll find the request by in the server logs. - HAR export on the Network tab — saves all the requests to one file that you can attach to a bug report.
Console and Network together answer the main question: is the bug on the frontend or on the backend? The request went out and returned 500 — go to the server logs. The request returned 200 with correct data, but the screen is empty and there’s a red line in the Console — that’s the frontend.
Centralised Logs: Kibana and Grafana Loki
When there are dozens of services and each runs in several instances, going from server to server with grep no longer works. The logs are collected in one place and searched through a web interface: it’s either the ELK stack (Elasticsearch stores, Logstash collects, Kibana displays) or Grafana Loki. The principle is the same as in the terminal, only the syntax changes. First narrow the time down to a few minutes around the bug — without that you’ll drown. Then filter by the same things as in grep: service, level, request id, user id, error text. In Kibana a query looks roughly like level:ERROR and service:"order-service", in Loki — like {app="order-service"} |= "req-7f3a9c"; the field names depend on the project. The skill of reading logs carries over completely: someone who can find the cause with grep will get the hang of Kibana quickly.
Real Interview Tasks
Task 1: “Which error in the log is the most frequent?”
There’s a file
app.log. Show which errors occur in it most often.
Answer: I assemble a chain of five commands: grep ' ERROR ' app.log | cut -d' ' -f7- | sort | uniq -c | sort -rn. And I explain each step: filter the errors, keep only the message text, sort, count the repeats, sort by count. I make sure to say why the first sort is needed: uniq only collapses adjacent lines. That’s exactly what the interviewer is checking — whether you understand the chain or memorized it.
A nice bonus is to notice that user=58 and user=64 make identical errors look “different”, and to suggest grouping by class: awk '{print $5}'.
Task 2: “A user complains: the order didn’t go through”
Support writes: user 58 couldn’t place an order at around 14:02. How will you find the cause?
Answer: I go from the known to the unknown.
- I find the request by user and time:
grep "user=58" logs/app.log - I take the request id from the line I found —
req-7f3a9c - I search for that id in all the logs:
grep -rh "req-7f3a9c" logs/ | sort - I read the stack trace down to the last
Caused by - I state the cause and file a bug with the request id, the time and the log line
I’ll ask support about the time zone right away: 14:02 for the user and 14:02 on the server aren’t necessarily the same moment.
Task 3: “The service doesn’t answer. Where do you start?”
The test environment doesn’t open. What do you do before writing to the developers?
Answer: I go from the outside in.
curl -i http://localhost:8080/healthfrom the server itself — is the service alive without the proxysystemctl status shop-apiorps aux | grep java— is the process runningss -tlnp— is it listening on its portjournalctl -u shop-api -n 100ortail -n 100on the log — what it wrote before it went downdf -handfree -h— has the disk or the memory run out
After that, what goes into the chat isn’t “the environment is down” but “shop-api went down at 14:05, the log says No space left on device, the disk is 100% full”. I won’t restart the service myself until I’ve saved the logs and warned the team.
Task 4: “The log is 5 GB”
You need to find an error in a 5 GB file. How will you open it?
Answer: definitely not with cat and not in a text editor — cat will pour millions of lines into the terminal, and an editor will try to load the whole file into memory.
Options depending on the situation:
tail -n 200 app.log— if the error has just happenedgrep "14:02:1" app.log— if the time is knowngrep -n "req-7f3a9c" app.log— if there’s a request idless app.log, thenGand a backward search with?ERROR— if you need to read around it
If the event happened yesterday — it’s most likely already in a rotated file, and you need to search with zgrep in app.log.1.gz.
Task 5: “How many requests returned 5xx?”
There’s an nginx access log. Count the responses by status code and find which addresses sent the requests that ended in a server error.
Answer: in the standard nginx format the first column is the client IP, the seventh is the path, the ninth is the status code.
awk '{print $9}' logs/access.log | sort | uniq -c | sort -rn
4 200
3 504
2 500
1 201
awk can filter too — the condition goes before the curly braces: awk '$9 >= 500 {print $1, $7, $9}' logs/access.log prints the IP, path and code for the five failed requests.
Conclusion: half of the requests ended in a server error, all the errors are on /api/orders, and both 500 responses went to the same client. Column numbers depend on the log format, so first I look at a single line with head -n 1.
5 Traps That Trip Up Candidates
1. Opening a big log with cat.
The terminal freezes, the lines you need fly past. For big files — tail, grep and less. Answering “how do you view a log” with cat gives away someone who hasn’t worked with real logs.
2. Searching only for the word ERROR.
You miss error in lowercase, 500 responses logged at the INFO level, and the WARN that appeared a minute before the crash and was the cause. Search with -i, by status codes and by request id.
3. Reading only the first line of a stack trace.
The first line is the consequence. The cause is in the last Caused by. A bug filed from the first line goes to the wrong team and comes back a week later.
4. Restarting the service without looking at the logs.
After the restart everything works — but the cause is still unknown, and tomorrow it will all happen again. First save the logs and the state (df -h, free -h, ps aux), then restart. The same goes for kill -9 as the first move.
5. Writing “there’s an error in the logs” in a bug report.
Which one, where, when? The developer will have to search all over again. Three things are needed: the exact time with the time zone, the request id and the log line itself with the stack trace — as text. And not the whole 200 MB log, but the fragment that matters.
Checklist: What to Know Before the Interview
- Connecting:
ssh user@host, logging in with a key,scpto download a file - Moving around:
pwd,ls -la,cd,cat,less,head,tail; why you don’t open a big file withcat - Live log:
tail -f,journalctl -u service -f - grep: the flags
-i,-n,-v,-c,-r,-A/-B/-C,-E - Pipes:
wc -l,sort | uniq -c | sort -rn,awk '{print $N}',cut - Reading logs: the parts of a line, the levels
DEBUG/INFO/WARN/ERROR/FATAL, request id, time in UTC - Stack trace: the first line, the last
Caused by, the first line of your own code - Diagnostics:
ps aux,top,kill,ss -tlnp,lsof -i,df -h,free -h,curltolocalhost - Permissions:
rwx, owner / group / others,chmod, wherePermission deniedcomes from - Where to look:
/var/log,journalctl, DevTools Console and Network, Kibana or Loki
That’s enough for most QA interviews. You don’t need to be able to administer a server, write complex bash scripts or know awk as a programming language — it’s enough to confidently log in to an environment, find the right line in the log and explain what it means.
Useful Resources
- OverTheWire: Bandit — a free game where every level is solved with Linux commands over
ssh. The best practice for a beginner. - explainshell.com — paste any command and get an explanation of every flag.
- GNU grep manual — the official
grepdocumentation with all the flags and regular expressions. - Chrome DevTools — the official documentation for the Console and Network tabs.
Free QA course with hands-on exercises at annayev.com (English, Russian, Turkish).
Give it a thumbs up if this was useful. What Linux or logs question have you been asked in an interview? Tell us in the comments.