We can use a command to check the different internet connections available on our system: ifconfig or ifconfig -a.
ifconfig
This command allows to know the IP addresses assigned to our RPi. The wlan0, indicates the status of the WiFi, and eth0 shows the status of the Ethernet (wired) connection). In the next screen shoot shows an example of a RPi connected to the internet using the ethernet port. The red oval shows where to find the IP address assigned to the RPi.
If you do not know what is an IP address, please go to the next link for a quick explanation. The IPs can be dynamic or static, but what is the difference? When a device is assigned a static IP address, the address does not change. Most devices use dynamic IP addresses, which are assigned by the network when they connect and change over time.
We already know how to connect through weaved service, but we know the connection last just 30 minutes and lets just to work on a terminal session at the time. Therefore, with the help of weave and another command we can connect to or RPi for longer and using multiple terminals.
ifconfig
Once you know the IP (e.g. your IP is 192.31.123.122), you can access using other terminal to the RPi as:
$ ssh pi@192.31.123.122
Remember that the root username is pi, the syntax for the ssh command is: ssh username@IP
or ssh username@machine_name
.
Note: Since at Imperial network the IPs are dynamic, the IP is constantly changing, so could be that the IP changes in a day or hours (could be sometimes longer) and you need to repeat the procedure using weaved.
If are programing in your laptop and you want to transfer it to test your code in your RPi, you can use this commands:
Commands | Description | Example | Syntax |
---|---|---|---|
scp |
Copy files from your machine to your RPi | scp program.py pi@123.232.232.3:/home/pi |
scp filename username@IP_of_machine:/path/where/to/Copy/in/RPi |
scp -r |
Copy folders from your machine to your RPi | scp -r code pi@123.232.232.3:/home/pi |
scp -r folder username@IP_of_machine:/path/where/to/Copy/in/RPi |
Screen is a full-screen software program allows you to use multiple windows (virtual VT100 terminals) in Unix. It offers a user to open several separate terminal instances inside a one single terminal window manager.
The screen application is very useful, if you are dealing with multiple programs from a command line interface and for separating programs from the terminal shell. It also allows you to share your sessions with others users and detach/attach terminal sessions.
One of the advantages of Screen, is that you can detach it. Then, you can restore it without losing anything you have done on the Screen. One of the typical scenario where Screen is of great help is when you are in the middle of SSH session and you want to download a file, update the operative, or transfer a big file to your RPi. The process could be 2 hours long. If you disconnect the SSH session, or suddenly the connection lost by accident, then the download process will stop. You have to start from the beginning again. To avoid that, we can use screen and detach it.
To find out more about its usage through some examples go to the link or ask the instructors.
Installing screen: The screen program allows you to use multiple windows (virtual VT100 terminals) in Unix. If your local computer crashes, or you are connected remotely and lose the connection, the processes or login sessions you establish through screen don’t get lost.
sudo apt-get -y install screen
Note: The next command is for updating and upgrading the Linux packages in the operative system, but it won’t be executed during the workshop since it can take a while. It is always good to keep the system up to date: sudo apt-get -y update && sudo apt-get -y upgrade
.