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.
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
- 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.
- Run the installer and finish the installation wizard.
- After finishing the wizard, set that aside and configure the Raspberry Pi to allow SSH.
Prepare Your Raspberry Pi
These instructions assume that your Raspberry Pi has already been set up with Raspberry Pi OS.
- Power up your Raspberry Pi (with a monitor, of course), then click the Raspberry Pi Icon, followed by “Preferences -> Raspberry Pi Configuration.”
- When a new window opens, move to the “Interfaces” tab, then enable the “SSH” option.
- 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.
- 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.
- 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.
Log in via SSH
- 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.”
- You will be greeted with a security alert, warning you about connecting to an unknown host. Click “Accept.”
- You will see a login prompt. By default, your Raspberry Pi should have “pi” as its username. The default password is “raspberry.”
- With all of that done, you are ready to use PuTTY to control your Raspberry Pi via SSH!
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:
- List files and directories:
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
- Making new folders:
mkdir <folder name>
- Using a text editor:
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.
- 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
Our latest tutorials delivered straight to your inbox