MicroPython runs on top of ev3dev, which is a specific version of Linux. Linux is an operating system. (Other popular operating systems are Microsoft Windows and Apple macOS.) This means that your EV3 is almost like a real computer, just much smaller.
The Linux command line
Although your EV3 Brick is quite like a real computer, you do not interact with it using a big screen and a mouse. Instead, you can access files and programs on it using the command line. It is also called the terminal.
Follow the steps shown below to access the command line. Now you can enter commands by typing them in and pressing Enter.
Running basic commands
For example, if you type the following command and press Enter:
then you will see the contents of the current folder. The figure above
shows the result: it listed the project folder of the
project that we just ran.
If you type the following command and press Enter:
then the command line will be closed. Alternatively, click the garbage icon in the terminal menu.
You can copy text from the command line by selecting it and then pressing Ctrl + Shift + C. You can paste text into the command line using Ctrl + Shift + V.
Running commands as an administrator
Some commands require a password to run. This is similar to administrative
tasks on your computer or tablet, such as installing a new app. These commands
work like any other command, but you add
sudo in front of
As an exercise, you can run the following command to turn the EV3 Brick off:
You will be prompted for a password. Type
maker and then press Enter.
Only run commands with
sudo if you know what you are doing!
Learning more about the command line
To learn more about the command line and many of the available commands, we recommend reading the beginner-friendly free ebook called The Linux Command Line.
To learn more about ev3dev-specific tips and tricks, visit the ev3dev website.
Changing the EV3 Brick name
When you search for your EV3 using Visual Studio Code, you see all EV3 Bricks listed by their name. By default, all EV3 Bricks are named ev3dev. Follow these steps to change that name:
- Open Visual Studio Code and connect to your EV3 as usual.
- Read the steps above about running commands as an administrator.
- Think of a good name. In this example, we’ll
Enter the following command and press Enter:
sudo hostnamectl set-hostname autonomous-vehicle2
- Reboot the EV3 Brick for the change to take effect.
- You may need to reboot your computer as well.
EV3 Brick names should only contain lowercase letters
9, and the hyphen
-. It must start with a
letter or digit. It cannot include spaces or other symbols.