How to Connect Raspberry Pi to Laptop: Complete Step-by-Step Guide (2025)

Photo of author

By Jackson Taylor

This guide shows you how to use your laptop to control your Raspberry Pi. You can skip buying extra display, keyboard, and mouse. I built my own setup and I know it works well. In this post, you will learn how to use SSH, VNC, Ethernet, and USB links.

What You’ll Learn

  • How to link via SSH for text control.
  • How to view the desktop with VNC.
  • How to establish a direct link with an Ethernet cable.
  • How to use a USB cable for Pi Zero models.

What You’ll Need

Hardware:

  • A Raspberry Pi (any model such as Pi Zero, Pi 3, Pi 4)
  • A laptop with internet
  • A microSD card (8GB minimum; 16GB is better)
  • A power supply for your Pi
  • An Ethernet cable (optional)
  • A USB cable (for Pi Zero)

Software:

  • Raspberry Pi OS installed on the SD card
  • SSH client (built into macOS and Linux, or PuTTY on Windows)
  • A VNC viewer (e.g. RealVNC Viewer)
  • An SD card formatting tool if needed

Basic Knowledge:

  • Use of command line tools
  • Understanding of IP addresses

Pro Tip: If you are new to this, get the Raspberry Pi Imager from the official site to load the OS onto your SD card.

Method 1: Link Raspberry Pi and Laptop via SSH

This method gives you text control over your Pi. It is simple and fast.

Step 1: Prepare Your SD Card

  1. Insert the microSD card into your laptop.
  2. Create a file named ssh in the boot folder. Do not add any extension.
  3. To set up Wi‑Fi, create a file called wpa_supplicant.conf in the boot folder with these lines:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
    ssid="YOUR_WIFI_NAME"
    psk="YOUR_WIFI_PASSWORD"
    scan_ssid=1
}

Step 2: Boot Your Raspberry Pi

  1. Insert the SD card into your Pi.
  2. Plug in the power.
  3. Wait about 60–90 seconds for the system to start.

Step 3: Find the Pi’s IP Address

  1. Make sure your laptop is on the same Wi‑Fi.
  2. Open Terminal (on macOS/Linux) or Command Prompt (on Windows).
  3. Run arp -a or type ping raspberrypi.local to get the IP address.
See also
How to Build an Arduino Air Quality Sensor (with Code)

Step 4: Link via SSH

  1. In your terminal, type:
ssh pi@<IP_ADDRESS>

Replace <IP_ADDRESS> with your Pi’s address.

  1. When prompted, use the default password raspberry.
  2. You will then see a prompt for the Pi.

Step 5: Secure Your Link

  1. Change the default password by typing:
passwd
  1. Follow the prompts to set a new password.

Method 2: Link Raspberry Pi and Laptop Using VNC

This method lets you see the Pi’s desktop on your laptop screen.

Step 1: Enable VNC on the Pi

  1. Use SSH to reach the Pi (follow Method 1).
  2. Type:
sudo raspi-config
  1. Select “Interface Options” then “VNC” and turn it on.
  2. Exit and reboot if requested.

Step 2: Install VNC Viewer on Your Laptop

  1. Download and install a VNC viewer (e.g., RealVNC Viewer).
  2. Launch the viewer and prepare to connect.

Step 3: Connect to the Pi

  1. Open the VNC viewer.
  2. Enter the Pi’s IP address and connect.

Step 4: Adjust the Pi’s Display Settings (Optional)

  1. Edit the boot configuration file:
sudo nano /boot/config.txt

Add or modify the following lines to set a virtual display size:

framebuffer_width=1280
framebuffer_height=720

After saving, reboot the Pi:

sudo reboot

Method 3: Ethernet Connection

Step 1: Connect the Ethernet Cable

Plug one end of the Ethernet cable into the Pi and the other end into your laptop or router.

Step 2: Configure the Network (Windows)

For Windows:

  • Open the Network and Sharing Center.
  • Click your Ethernet adapter and then Properties.
  • Choose “Internet Protocol Version 4 (TCP/IP)” and set:
  • IP address: 192.168.1.100
  • Subnet mask: 255.255.255.0

For macOS:

  • Go to System Preferences > Network.
  • Select the Ethernet connection.
  • Change “Configure IPv4” to “Manually”.
  • Set:
  • IP address: 192.168.1.100
  • Subnet mask: 255.255.255.0
  • Click Apply.

Step 3: Test the Connection

  1. Open a terminal on your laptop.
  2. Ping the Pi’s IP address to verify connectivity.

Step 4: Share Your Laptop’s Internet (Optional)

For Windows:

  • Open Network Connections.
  • Right‑click your Wi‑Fi connection and choose Properties.
  • Click the Sharing tab.
  • Tick “Allow other network users to use this computer’s internet”.
  • Choose the Ethernet connection.
See also
Best Arduino Starter Kit for Beginners to Start Building

For macOS:

  • Open System Preferences > Sharing.
  • Tick “Internet Sharing”.
  • Share from Wi‑Fi to Ethernet.
  • Click Start.

Step 5: Connect via SSH (Optional)

  1. In your terminal, type:
ssh [email protected]

Replace the IP address with the one you configured for your Pi.

Method 4: USB Link (Headless Setup)

Step 1: Prepare the SD Card

  1. Insert the SD card into your computer.
  2. Open the config.txt file on the boot partition and add the following line:
dtoverlay=dwc2
  1. Save and close the file.
  2. Create a file named ssh (no extension) in the boot partition.

Step 2: Enable USB Gadget Mode

  1. Edit config.txt again and add:
modules-load=dwc2,g_ether

Step 3: Boot the Pi

  1. Insert the SD card into the Pi and power it on.
  2. The Pi will appear as a network device on your laptop.

Step 4: Connect via SSH

  1. On your laptop, open a terminal and type:
ssh [email protected]
  • Enter the default password raspberry when prompted.
  • Advanced Configuration

    Startup Tasks

    Create a folder for autostart entries:

    mkdir -p ~/.config/autostart

    Create a new desktop entry file:

    nano ~/.config/autostart/myapp.desktop
    [Desktop Entry]
    Type=Application
    Name=MyApp
    Exec=/usr/bin/myapp
    Icon=application-default-icon
    Terminal=false
    

    Fixed IP Setup

    View the current network configuration:

    ip addr show

    Edit the DHCP configuration file to set a static address:

    sudo nano /etc/dhcpcd.conf

    Advanced Topics

    Startup Tasks

    1. Create a folder for autostart entries:
    mkdir -p ~/.config/autostart
    1. Create a new desktop entry file:
    nano ~/.config/autostart/myapp.desktop
    [Desktop Entry]
    Type=Application
    Name=MyApp
    Exec=/usr/bin/myapp
    Icon=application-default-icon
    Terminal=false
    

    Fixed IP Setup

    1. Check the current IP configuration:
    ip addr show
    1. Edit the DHCP configuration file:
    sudo nano /etc/dhcpcd.conf

    FAQs

    • Can I use Wi‑Fi instead of Ethernet? Yes, configure wpa_supplicant.conf as shown in Method 1.
    • Do I need a separate VNC server? No, the built‑in VNC server in Raspberry Pi OS is sufficient.
    • What if my Pi doesn’t appear in the network list? Ensure SSH is enabled and the Pi is powered on.