Learn how to save PuTTY output in logfile locally on desktop. Important settings to be done on PuTTY client before you start your sysadmin work!
PuTTY is one of the widely used SSH, telnet client to connect Linux Unix servers. Its open source software and can be downloaded here. This article is intended to beginners who just stepped into command line world of *nix. Experienced sysadmins already knew what this article is all about!
Most of the beginners are not familier with PuTTY settings and they just use default ones. This leaves them into two troubles :
- If command output is too long, it scrolls up PuTTY screen and output beginning is not visible.
- After closing PuTTY session, user dont have trace of what he did in his session.
To avoid them we need to tweak few settings in PuTTY and set them in default ones. So that next time you fire up PuTTY client, it starts with tweaked settings as default and makes your life easy!
How to increase PuTTY scroll length
Many times your output is long enough to scroll beyond PuTTY screen buffer and you wont be able to get to the beginning of output. To avoid this you need to increase screen buffer size in settings. Lets see how to do it. Open PuTTY and select ‘Window‘ on left side pane as below :
You will be presented with settings page on right which has field where you can set ‘Lines of scrollback‘. Enter number of your choice here (big enough). Thats it. Now PuTTY will be having scroll buffer of number of lines you specified. Never lost your output beyond scroll!
How to save PuTTY session output on local storage
Next challenge is user dont get any logs saved by default in PuTTY. So in case you want to check list of commands you ran and their outputs, its not possible to check (once you close your session). Here session logging comes to rescue. Lets see how to set it. Open PuTTY and select ‘Logging‘ under ‘Session‘ on left pane.
You will present with logging settings on right. Session logging is off by default. You need to check bullet box next to ‘All session output‘ to log all session output in file. Provide log file name using browse button (specify where to save logs on your system). You can use parameters like &Y, &M (meanings listed below option), so that every time you start a new session, new logfile have unique name. This will avoid overwriting existing file with same name.
PuTTY also offers you to set options what to do when it finds file name already existing on specified path. You can choose to overwrite, append or ask user.
Now whatever commands you type and outputs you see in your session will be saved as it is in file on your computer as well. These log files can be opened in notepad/wordpad to view later. Be sure you dont leave your session running with commands like top (which continuously changes data on screen for infinite time). Because this will fill up your logfiles fast and you may end up in filling your local hard disk!
Save customized settings in PuTTY as default settings
Now you learned these two settings which are very much important to set but you dont want to set it everything you fire up PuTTY client. You can save them as defautl setting!
Open PuTTY and do above changes. Now, click and select ‘Session‘ on left pane which will bring you back to client home screen.
Now click and select ‘Default Settings‘ as shown above and click ‘Save‘ . Thats it! Your customized settings are now saved as default settings. Now whenever you start PuTTY client it will start with your customized settings.
Have any tips regarding PuTTY client? Share with us in comments section below!