How to Control your Raspberry Pi through Windows via SSH

You can use the Raspberry Pi even without a monitor.

Raspberry Pi Windows Ssh Featured

Maybe you’ve gotten bored of repeatedly jamming a cable on that HDMI port. Or perhaps you’ve broken the port already. Either way, you can use the Raspberry Pi even without a monitor, thanks to SSH. That’s called a “headless computer,” and it’s a lifesaver that makes many things easier.

What’s a Headless Computer?

A headless computer is a computer without a monitor. The computer can be anything – it doesn’t even have to be a Raspberry Pi. To give an example, the web server that lets you access this webpage from any part of the world is probably a headless computer from some data facility.

Mini Pc Raspberry Pi

Headless computers can be controlled through different means. Some listen to a webpage to receive commands, while others let you remotely connect and control them via commands on a console. This time, we are doing the latter.

Turn Your Raspberry Pi into a Headless Computer

We are splitting this up into three parts. The first one is for downloading PuTTY for Windows, the second for preparing the Raspberry Pi for SSH, and the last for logging in to the Raspberry Pi through Windows via SSH.

Download PuTTY for Windows

  1. Download the x86 version of PuTTY. If you are unsure of your Windows PC’s architecture, the safe bet is to download the 32-bit version, as it can run on both 32- and 64-bit systems. Download the 64-bit version only if you’re sure that you’re using a 64-bit system.
Putty Download Page
The PuTTY download page is hosted on a different domain from the homepage.
  1. Run the installer and finish the installation wizard.
Putty Installation Wizard
  1. After finishing the wizard, set that aside and configure the Raspberry Pi to allow SSH.
Putty Application Screen
PuTTY configuration window

Prepare Your Raspberry Pi

These instructions assume that your Raspberry Pi has already been set up with Raspberry Pi OS.

  1. Power up your Raspberry Pi (with a monitor, of course), then click the Raspberry Pi Icon, followed by “Preferences -> Raspberry Pi Configuration.”
Raspberry Pi Rpi Configuration
  1. When a new window opens, move to the “Interfaces” tab, then enable the “SSH” option.
Rpi Configuration Interface And Ssh Settings
  1. Check whether your Raspberry Pi is connected to your Wi-Fi router. If not, click on the Network icon, followed by your Wi-Fi network name.
Raspberry Pi Wifi Networks
  1. If you click on your Wi-Fi network name, a new window will pop up. This will ask you for your Wi-Fi password. Skip this step if you’re already connected to your Wi-Fi network.
Raspberry Pi Wifi Password
  1. Open the terminal and type ifconfig. You’ll find a list of information about your Raspberry Pi’s network connections. Look for “wlan0,” then copy the IP address next to “inet” for the next step.
Terminal Ifconfig Ip Address
Write down the IP address next to the word “inet.”

Log in via SSH

  1. Open the PuTTY app in Windows, then type the IP address into the box that says “Host Name (or IP address).” Keep the port at 22. Make sure that the “Connection type” is set to SSH, then click “Open.”
Putty Input Ip Address
  1. You will be greeted with a security alert, warning you about connecting to an unknown host. Click “Accept.”
Putty Security Alert
  1. You will see a login prompt. By default, your Raspberry Pi should have “pi” as its username. The default password is “raspberry.”
Putty Login Prompt
You won’t see asterisks or anything while typing in the password area. It’s a security feature.
  1. With all of that done, you are ready to use PuTTY to control your Raspberry Pi via SSH!
Putty Ssh Terminal

What Can You Do with Your Headless Raspberry Pi

Now that you know how to access the terminal on your Raspberry Pi through Windows via SSH, you need to know how to do stuff with it.

You have to remember that the Raspberry Pi OS is based on the Debian distro for Linux, so you can use Linux terminal commands on the PuTTY terminal when doing most actions.

However, that only works if you have the Raspberry Pi OS on your Raspberry Pi. It won’t work if you have something else on your system, like Windows 11.

Important Linux Terminal Commands

Given all that, there are some commands you have to know if you’re not used to doing stuff on the Linux terminal yet. The following are a few codes you might want to know.

  • Turn off computer: sudo shutdown -h now
  • Reboot computer: sudo reboot -h now
  • Change directories: cd <path>
  • List files and directories: dir or ls

Without a file explorer to click on, you’re left to type where you want to go on the terminal window. Use cd to change directories and dir to show what’s inside the current directory.

Reading a little bit deeper into the Linux virtual directory structure might help you better understand how cd works.

  • Making new folders: mkdir <folder name>
  • Using a text editor: nano <filename>

nanois perhaps the simplest text editor out there and lets you write text files and programming scripts on the go. While it’s not an IDE that can compile code for you, it’s good enough when you’re just doodling with coding ideas.

Nano Terminal Window New File
The terminal window should look like this after entering nano your-filename.txt.
  • Deleting files and folders: rm <file or folder name>

Check out this article for more details on deleting files in Linux.

  • Installing packages: sudo apt <install or uninstall> <package 1> <package 2>

Typically, this command is used to install or uninstall one or more packages. For instance, you can install the Python 3 package for controlling the Raspberry Pi’s GPIO pins by typing sudo apt-get install python3-rpi.gpio.

You may want to learn more about apt if you want to do more software-related things on the Raspberry Pi.

Frequently Asked Questions

What happens if I cd into a nonexisting directory?

If you try using the cd command to go to a non-existing directory, the terminal will return “No such file or directory” and not do anything else.

What should I do when I make a typo while typing the password?

If you make a typo, use backspace to delete the last character you typed. Alternatively, use <- and -> along with Home and End to navigate between characters or Ctrl + A to select everything, then press Delete or Backspace to remove it all, which is useful if you don’t know which character was wrong.

Why is there a warning message when I shut off my Raspberry Pi?

When you shut it down, PuTTY only knows that it suddenly lost its connection with the Raspberry Pi. It doesn’t know if it shut itself down or got disconnected from the network. Hence, a “Fatal Error” warning message should show up after you enter sudo shutdown -h now on the terminal. The same should also work for all of its other variants, like the commands for rebooting.

Image credit: close-up of raspberry pi pico by 123RF

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox