How to Share an Error Log, Stack Trace or Terminal Output So Someone Can Help
Updated November 5, 2026 · 8 min read
"It crashed, here's a screenshot of the terminal" is a common start to a long debugging session. The person helping needs the text: the full error, the stack trace and the command that caused it. Here's how to capture logs and terminal output completely, trim them sensibly, remove secrets, and share them in a form people can work with.
Step 1: capture the full output as text
Copy from the terminal
- Windows Terminal and PowerShell: select with the mouse, then Ctrl + C (or Ctrl + Shift + C, depending on settings).
- macOS Terminal and iTerm2: select, then Cmd + C.
- Linux terminals: select, then Ctrl + Shift + C.
Save it to a file (better for long output)
# macOS, Linux, Windows Command Prompt: normal output and errors into one file
npm run build > build-log.txt 2>&1
# Also show it on screen while saving (macOS/Linux)
npm run build 2>&1 | tee build-log.txt
# PowerShell: capture every stream
npm run build *> build-log.txt
The 2>&1 part matters: most errors are written to a separate "error" stream, and
without it, your file may contain everything except the error.
Browser and app logs
- Browser console: F12 > Console, then right-click > Save as.
- Server logs: copy the lines around the time of the error, for example
tail -n 200 /var/log/app/error.log. - Docker:
docker logs --tail 200 container-name.
Step 2: keep what matters
A 5,000-line log buries the problem. Keep:
- The command you ran and your working directory.
- The first error. Later errors are often side effects of the first.
- The full stack trace for that error, including any "Caused by:" sections.
- About 20 to 50 lines before the error for context.
- Versions: runtime, framework, OS (for example
node -v,python --version).
How to read a stack trace (so you share the right part)
TypeError: Cannot read properties of undefined (reading 'email') <- what went wrong
at formatUser (src/users/format.js:14:22) <- your code: start here
at Array.map (<anonymous>)
at listUsers (src/users/list.js:31:18) <- your code: the caller
at Layer.handle (node_modules/express/lib/router/layer.js:95:5) <- library code
The top line says what happened. The first frames in your files say where. Library frames further down are usually less important, but include them anyway; trimming them is the reader's choice.
Step 3: remove secrets and personal data
Logs often contain tokens in URLs and headers, database connection strings, email addresses, IPs and
file paths with your username. Replace them with [REDACTED] before sharing. The full
checklist is in how to share a config
file safely.
Step 4: share it as a link
- Paste the trimmed, redacted log into the code sharing tool.
- Choose Plain text (or Bash for shell sessions) and give it a title, such as "npm run build fails after upgrading to Node 22".
- Share the link with the command and one sentence of context.
Line numbers let helpers point to "line 212", the raw view lets them copy or download the exact text, and the formatting survives any chat app. Snippets up to 512 KB are supported, which fits very long logs.
A message that gets fast help
Running `npm run build` fails since upgrading Node 20 -> 22.
Log (first error at line 48): https://sshot.online/c/Lg8Tn3q
Environment: macOS 15, Node 22.4, npm 10.8
Already tried: deleting node_modules and reinstalling
When a screenshot helps too
Add a screenshot only when something is visual: an error dialog, a broken page, or garbled characters. For dialogs, follow how to capture and share an error message.
Paste up to 512 KB of text and get a link with line numbers and a raw view. Free, no account.
Frequently asked questions
How do I share terminal output?
Copy it as text (or save it to a file with output redirection), remove any secrets, and paste it into a code-sharing tool. Send the link along with the command you ran.
How do I save command output to a file?
Add > output.txt 2>&1 to the command on macOS, Linux and Windows Command Prompt to capture both normal output and errors. In PowerShell, *> output.txt captures all streams.
Which part of a stack trace matters most?
The exception type and message, the first lines that point to your own code (not library code), and any "Caused by" sections further down.
Should I send a screenshot of the terminal?
Not for the output itself; it cannot be copied or searched. A screenshot can help only to show something visual, like garbled characters or colours.
Related articles
How to Capture and Share an Error Message So It Actually Gets Fixed
Capture error dialogs, browser console errors and app crashes the right way: when to screenshot and when to copy text, what context to include, and a template for sending it.
Read More →How to Share Code Snippets Online Without Breaking the Formatting
Share code so indentation survives: why chat apps mangle code, how to share a clean link with line numbers and a raw view, how to choose between a snippet link, a gist and a screenshot, and what to remove first.
Read More →How to Share a Config File Safely: A Redaction Checklist for .env, YAML and nginx
Share .env, YAML, JSON and nginx configs for debugging without leaking secrets: what to redact, consistent placeholders, examples, and what to do if a key was exposed.
Read More →