> For the complete documentation index, see [llms.txt](https://cookiez.gitbook.io/red-team/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cookiez.gitbook.io/red-team/general/configuration/terminal-logging.md).

# Terminal Logging

```bash
#terminal logging
cd ~/
mkdir -p /opt/bashLogs
echo "alias rec='script -f -c /bin/zsh -O /opt/bashLogs/\$(date +\"%Y-%m-%d_%H-%M-%S\")_shell.log'" >> ~/.zshrc
echo 'test "$(ps -ocommand= -p $PPID | awk '\''{print $1}'\'')" = '\''script'\'' || script -f -c /bin/zsh -O /opt/bashLogs/$(date +"%Y-%m-%d_%H-%M-%S")_shell.log' >> ~/.zshrc
```

creates a new /opt/bashLogs/$(date +"%Y-%m-%d\_%H-%M-%S")\_shell.log for each new shell created.
