How to export a registry entry to file

The reg program can be used to operate on the Windows registry from the command-line. Exporting registry entries is one of the tasks it can perform. Exporting registry entries is useful to save settings to a file and restoring or importing those settings on a different computer.

To export a registry entry, provide its registry path and an output filename. For example, to export the settings of the PuTTY program I used this invocation:

reg export HKEY_CURRENT_USER\Software\SimonTatham\PuTTY putty.reg

This exported the entries to the putty.reg registry entry file.

There is also a program from NirSoft called RegFileExport that offers to do this job. But I found that it did not work for me. It probably only works on offline registry hives.

Tried with: Windows 10 Enterprise

Arrow keys not working in tmux from PuTTY

Problem

I SSH into a Ubuntu computer from a Windows computer using PuTTY. I run tmux (actually byobu which runs tmux underneath) and at a shell inside tmux I find that the left and right arrow keys do not work. They are actually detected as shift+left and shift+right arrow keys inside tmux.

Solution

This problem has been discussed here. One of the suggested solutions was to add set enable-keypad on to ~/.inputrc. That did not seem to work for me.

However, the above bug report also mentioned that this was a bug in tmux and it was fixed in tmux 2.4. So, I used this tmux PPA and updated the tmux 2.1 shipping in Ubuntu 16.04 to a tmux 2.6. The arrow key problem disappeared.

How to use vim-powerline plugin in PuTTY and Windows

Statusline displayed by vim-powerline
Statusline displayed by vim-powerline

The vim-powerline plugin can be used to enable a statusline in Vim that is both beautiful and informative. Using it fully on Windows and especially for use with PuTTY has a few problems:

  1. The Consolas font needs to be patched to view the fancy Unicode symbols in the statusline.
  2. Visual mode string symbols are not downloaded properly from Github.
  3. Mercurial symbol in Consolas, a lightning symbol, does not display for some reason.
  4. Patched Consolas font name cannot be distinguished from the default Consolas in PuTTY.

I have forked the main vim-powerline repository and fixed these issues in it. These fixed files can be obtained here. Follow the instructions from my post on vim-powerline with this fork and you should be able to get the plugin running on Windows.

For PuTTY, remember to change the font for you SSH session to Powerline-Consolas and also ensure that the terminal can support 256 colors.

Tried with: PuTTY 0.62 and Windows 8 x64

How to install and use vim-powerline plugin for Vim

Statusline displayed by vim-powerline
Statusline displayed by vim-powerline

The statusline in Vim gets the job done: it shows the current mode and the location of the cursor in the currently open file. The vim-powerline plugin is a great way to jazz up the statusline of Vim and show lots of useful additional information. (As of this writing, folks are working on a new powerline plugin. This post is about the older vim-powerline plugin.)

Installation

The powerline plugin can be installed for Pathogen by cloning its Github repository.

Color support

The plugin uses lots of bright colors and needs 256-color support in Vim. One way to turn this on in Vim is by adding this line to your vimrc:

set t_Co=256

Fancy symbols

By default it shows a simple colored statusline. By using Unicode symbols, it can present a more beautiful statusline. To turn this on, add this line to your vimrc:

let g:Powerline_symbols = "fancy"

Patched fonts

The plugin can show symbols if the file is in version control (Git or Mercurial), for the filetype, for the line number and many more. For this to work, you need to patch your font and use that patched font for your terminal or Vim.

If you are on Ubuntu and using the default Ubuntu Mono font, then a patched version of this font can be obtained here. Follow the instructions on that page to install the fonts.

If you are on Windows and using Consolas, either directly or through SSH with PuTTY, I have more information in another post.

For other fonts and setups, use the script and directions in the fontpatcher directory.

Additional plugins

The plugin can show information on syntax errors and also version control information for Git and Mercurial. To view these status symbols and messages, install these three plugins: syntastic (for syntax checking), fugitive (for Git) and hgrev (for Mercurial).

With all this set up correctly, you get a Vim statusline that looks gorgeous and shows lots of useful information, both in terminal and GUI modes.

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

How to make PuTTY portable

The PuTTY executable can be carried around on a USB thumbdrive or shared using Dropbox. However, the PuTTY sessions (profiles) that you created on a computer are stored in that computer’s registry and are hence not portable.

An easier way to make PuTTY portable is to install and use PortablePuTTY. It stores the sessions locally in a reg file and so you can use those profiles from any location transparently.

Tried with: PortablePuTTY 0.62

How to auto-login with username using PuTTY

PuTTY is a popular SSH client on Windows. SSH accepts a username using which it can auto-login, thus saving you the hassle of having to type it in every time. This can be configured in PuTTY easily.

Choose the session you want to configure and click Load. Go to Connection β†’ Data and enter the username you want to use in Auto-login username. Save the session.

Tried with: PuTTY 0.62

Byobu function keys do not work in PuTTY

Problem

You are running Byobu on a remote computer to which you have connected using PuTTY. Everything works fine, except that the Byobu commands that use function keys (like F2, F3 and F6 for example) do not work. This problem is caused because the sequences sent by PuTTY for function key press does not match what Byobu expects.Β This can be fixed easily in PuTTY.

Clean solution

Load the session you use to connect to the remote computer. Go to Connection β†’ Data and set the Terminal-type string to putty-256color. Save the session.

Dirtier solution

Load the session. Go to Terminal β†’ Keyboard and choose Xterm R6 in the Function keys and keypad section. Save the session.

Tried with: PuTTY 0.62 and Byobu 5.17

Byobu status line scrolls up in PuTTY

Problem

You connect to a server using PuTTY and run Byobu there. Everything looks fine, except the status line at the bottom starts to scroll up.

Solution

This problem is caused because by default PuTTY thinks that the characters it is receiving from the remote computer are encoded as ISO-8859-1. But, Byobu is encoding its characters in UTF-8. So, fixing this is simple.

Load the session you are using to connect in PuTTY. Go to Window β†’ Translation and change the Remote character set to UTF-8 from the dropdown. Save the session.

Tried with: PuTTY 0.62 and Byobu 5.17

How to SSH wirelessly to your Nook Color running CyanogenMod 10

SSH to Nook Color running CyanogenMod 10
SSH to Nook Color running CyanogenMod 10

The Nook Color can be easily made to run CyanogenMod 10. If such a Nook Color is connected to the same home (wireless) network as your computer, then it is pretty easy to SSH to it wirelessly.

  1. Make sure your Nook Color running CM 10 is powered on and connected to the home network.
  2. Note down the IP address assigned to your Nook Color. Since the IP address given by DHCP varies, it is convenient to assign a static IP address to your Nook Color.
  3. Install a SSH server on the Nook Color. I installed DropBear Server II from the Google Play Store.
  4. Start the DropBear Server II app. Choose Install. You will be asked to provide it superuser privileges.
  5. Start the SSH server by choosing Start in DropBear Server II.
  6. The password for root user can be found in the Settings section of DropBear Server II. Change it to anything you want.
  7. On your computer, ping the IP address of the Nook Color to make sure it is reachable over wireless. If you cannot ping it, you have some networking problem.
  8. If you can ping your Nook Color and its SSH server is running, then SSH to it using PuTTY. Provide the IP address of Nook Color and use root as user and password set in DropBear Server II as the password.

Happy hacking! πŸ™‚

Tried with: Nook Color 8 GB, CyanogenModΒ 10-20121228-NIGHTLY-encore and DropBear Server II 1.5.4

How to SSH to your Raspbmc from Windows

SSH into Raspbmc

You have installed Raspbmc on your Raspberry Pi, converting it into a cool little HTPC. (Here is how to do that.) The Pi is running Linux after all and it is connected to the home network. Now, you want to SSH into it to explore its internals. That is easy.

PuTTY can be used to SSH
  1. In your Raspbmc, navigate to System β†’ System info β†’ Summary. Take note of theΒ IP addressΒ (for example: 192.168.0.12) that has been assigned to your Raspbmc.
  2. Ping your Raspbmc to make sure it is reachable from the computer you want to SSH from. For example: ping 192.168.0.12. If the ping does not work, check the settings of your wireless router.
  3. Use PuTTY and SSH to your Raspbmc using its IP address and port 22.
  4. At the login prompt presented by your Raspbmc use the username pi and password raspberry.

Bingo! You are inside your Raspbmc now. Have fun playing around with it πŸ™‚

Tried with: Raspbmc RC3