Lesson 4 How To View or Edit The Code Program in Raspberry Pi
Lesson 4 How To View or Edit The Code Program in Raspberry Pi
To make daily use of the Raspberry Pi more convenient, we usually do not connect peripherals
such as mouse, keyboard, and monitor to the Raspberry Pi. Since our Raspberry Pi is installed inside
the robot, often with peripherals to control the Raspberry Pi, the efficiency of programming and
testing will be seriously affected. Therefore, we introduce a method of programming in the
Raspberry Pi.
⚫ A third-party software Putty will be used for this method. For detailed instructions, refer to
3.6.2 Remotely logging in to the Raspberry Pi system.
Operation Steps
1. Run Putty, type in the IP address of your Raspberry Pi and click open. Enter your user name and
password – with the initial user name: pi, password: raspberry.
Support email:
2
3. Type in "sudo nano <file path>" to view or edit a file, as shown below:
4. Exit. Press Ctrl + X on your keyboard to exit if nothing is changed. Otherwise press Y and Enter
key to save and exit.
⚫ A third-party software MobaXterm will be used for this method. For detailed instructions, refer
to 3.6.2 Remotely logging in to the Raspberry Pi system.
Support email:
3
To run MobaXterm, firstly, create a new session, click Session in the upper left corner, click
SSH in the pop-up window, fill in the IP address of the Raspberry Pi behind Remote host, and finally
click OK, the default account name of the Raspberry Pi is pi , The default password is raspberry. Just
the password doesn't appear on the screen when you enter it and the * number doesn't mean nothing
Enter successfully, press after login to log in to the Raspberry Pi, MobaXterm will remind you to
save the password.You need to choose.
⚫ If the user name and password are correct, you can change the user name and password
according to the prompt in the terminal, which is more secure.
⚫ After the success of the login, MobaXterm will automatically save the conversation, when
connected to the raspberry pie again next time only need to double click on the left side of the IP
address can be connected to the Raspberry Pi again, if there is no save username and password
will need to input the user name and password, if the IP address of the Raspberry Pi changed,
you need to start a new dialogue.
⚫ After a successful login, the left column is replaced with a file transfer system, which allows you
to interact with the system inside the Raspberry Pi. If you want to return to session selection, just
click Sessions.
⚫ Programs you write on other devices can be transferred to the Raspberry Pi by simple drag and
drop, and then the Raspberry Pi can be controlled in the terminal to execute the program, or the
files in the raspberry Pi can be dragged to other devices.
Support email:
4
⚫ If you want to use another IDE to edit files in Raspberry Pi, you can find the file you want to
edit in the file transfer system on the left side of the MobaXterm. Right-click on this file and
select your IDE so you can use your favorite on other devices IDE to edit the Raspberry Pi file,
after editing, press "CTRL+S" to save the file and it will be automatically synchronized to the
Raspberry Pi.
⚫ However, it should be noted that when you use MobaXterm's file transfer system to edit files in
the Raspberry Pi, you need to pay attention to the permissions problem, because the file transfer
system does not have root permissions, so if you are prompted to save after editing the file The
permission denied error causes the file cannot be saved after editing. You need to use the
following command to give the file you want to edit permission to be edited by MobaXterm:
Support email:
5
https://www.maketecheasier.com/file-permissions-what-does-chmod-777-means
Support email: