Just moved off from windows into a Mac. I used to use Putty and it has a feature of logging sessions into a folder so everything that happens (stdin/out) goes also to a folder for historic record.
I would like to have the same thing with Mac Terminal app.
ssh – Automatic log each session from Terminal
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
Asked
Viewed
288 times
There are two ways I am aware of:
- Run all the commands you want in Terminal. Before closing the window go to Shell -> Export Text As… (or press CMD+S). This exports a text file with all the input and output of that session.
- Start
script
at the beginning of your session, e.g. with:/usr/bin/script ~/Desktop/Terminal.log
. When you’re done with the session typeexit
and a log file with all the input/output will be written (an example can be found in this other answer).
I found that the first method handles colours in the output better: it simply ignores it and writes the text to the file.
The script
method writes control characters such as [1m[0m[1m[36m
instead, which creates noise in your log. If you don’t have any coloured output, that’s no problem. If you do, perhaps there’s an option for script
that can handle this.
1
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged .
lang-bash
Categories