> For the complete documentation index, see [llms.txt](https://knowledge.tracelog.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledge.tracelog.in/linux-and-core/linux/record-ssh-session-for-reporting.md).

# Record SSH session for reporting

The issue is whenever logging ssh to a linux vm for investigating or doing something, after done, I want to report on **what I did** for writing into ticket. In the past, I use the `history`command and scroll back to the beginning. It's waste of time & effort, sometime cannot trace because of lacking scroll or closing terminal tab by human mistake, or wanna trace in the next few days.

So that I need a good solution for this to work effectively

```bash
touch /ssh.log
ssh <target> -v | tee -ia /ssh.log
```

For seeing output for tracking & reporting, use `tail`

```bash
tail -f -n +1 /ssh.log
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://knowledge.tracelog.in/linux-and-core/linux/record-ssh-session-for-reporting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
