We assume you have your Raspberry Pi up and running and most likely connected to a TV or screen through an HDMI cable. In this post we’ll briefly explain how to access and control your Raspberry remotely without having to have your Raspberry connected to a TV or screen, without keyboard and mouse. If you need guidance how to set up your Raspberry for the first time, follow this simple instruction.
What do you need to access your Raspberry remotely?
- First you need to have the Raspberry connected with an ethernet cable to the router of your home network. I other words, your laptop needs to be on the same network (wifi or ethernet) as the Raspberry.
- Secondly, your Raspberry needs to be turn off i.e. plugged in with a power adapter.
- You need to know the IP number of your Raspberry. In our case it’s 192.168.1.99. Yours could be different since it’s up to your internet router to hand out different IP addresses to all devices in your home network. The IP number is the identification number for sending data to and from devices on a network. One way to find out the IP number of your Raspberry is to log in to your network router and look at the list of the devices currently on your network. If you’re not able to find out the IP number of your Raspberry that way, we’ll go through another way below by using the command line terminal from your laptop.
Connect by using the command line terminal
In this post, we will remotely connect to the Raspberry from our laptop using the command line terminal (also known as SSH). This method is based on text commands. Simple, boring but effective. On your Mac, open “Terminal”. You find this by accessing the Launchpad, go to the Utilities folder and there it is. (If you’re using Windows, you can download a free SSH client from here)
If you’re not used to a command line interface (such as Terminal), it allows you to type in text based commands to control, configure and communicate. The text already appearing in the Terminal window is the name of the computer, the current folder you’re in, and the current user name. You type your commands after the $ sign. If you for example type “ls” without the quotes and hit enter, you see a list of all files in the current folder “example_folder”.
Now, to remotely connect to our Raspberry, we type “SSH firstname.lastname@example.org” without quotes and hit enter. Your Raspberry has probably another IP address so replace 192.168.1.99 to match yours. If you haven’t yet, you can find out the IP number of your Raspberry by typing “ping raspberrypi”. This outputs some information in the Terminal and one item is the IP number of your Raspberry. To stop the ping output, simply press ctrl + C.
Our Raspberry asks us for the password of the user “pi” which is the default user. The default password is “raspberry”, so we type it in and hit enter. The terminal window will not add any characters or dots while we type the password like your might be used to from most login windows.
Now you see the prompt “pi@raspberrypi:~$”. Every command you type from here is executed on your Raspberry. Magic! If we now type “ls” you list the files in the current directory on the Raspberry.
If you would like to exit the SSH connection with your Raspberry, simply type “exit” and press enter, and you’re then back to your laptop’s prompt again. Executing a command now will be handled by your laptop and not your Raspberry.
Using the command line to remotely control your Raspberry is very effective and simple. There is a getting-used-to-text-command-time before you feel comfortable. If you after a while still prefers a graphical user interface, you should check out this post on how you remotely control your Raspberry from your laptop by mirroring the graphical user interface. It’s very simple as well!