Tag Archives: screen

Using screen to log a terminal session

Note to self: use screen when doing a bunch of remote administration stuff over an SSH connection. You can tell it to log the session to a separate file, and can detach the session and log off without having the remote shell be terminated. Then later you can resume the session and haven’t lost anything.

To start a shell and log everything to a file, do

screen -L -S mysession

That drops you into a new shell, and lets you refer to that session later (in case you are ambitious and have many screen sessions running simultaneously). To detach the session type CTRL+a then d. From there you can exit cleanly. To resume the session later, type

screen -r mysession

The session history will be saved to a file named screenlog.0 or similar in the directory where screen was first invoked.

screen man page online (Hmmm… looks like the hmug man pages have renamed themselves.)

I should use screen more often. I should also get in the habit of going through the contents of $PATH every time Mac OS X gets updated.