Is there a log of recent terminal sessions at all? Or anyway I can see what was written to console before I last quit?
Asked
Active
Viewed 3.8k times
1 Answers
38
There is the option to save a log of your session to a file, however, by default this isn't done.
To activate the session logs, go to iTerm2 Preferences (⌘,), select the "Profiles" tab, then the "Session" tab. Under "Miscellaneous" you can specify a folder where log files for your sessions shall be saved in the future.
Edit:
These session logs can become quite big, so you might want to have a look from time to time to not clutter your drive.

TabeaKischka
- 793
- 6
- 15
-
1Anyone else having an issue retrieving the logs? mine is scattered with random posix characters and memory addresses – Jonathan Feb 12 '20 at 00:53
-
1@Jonathan if you open a terminal and run `cat logfile.log` it should print the recorded session into your terminal. – orhanhenrik Feb 26 '20 at 14:39
-
Is there a way to open these in an editor like sublime? – Daniel Kobe Apr 30 '20 at 17:53
-
@DanielKobe go to the folder specified on that settings panel, and open them with any text editor you like. – Mike Lyons Aug 18 '21 at 21:00
-
1This option says log session input into files ? Does it include the output of the commands we run as well on the ssh sessions like some bash command outputs that gets printed on the terminal – BlackBurn027 Jun 09 '22 at 04:03