You are in the middle of a Raspberry Pi project when you suddenly realize that something is wrong: fixing it means editing the config.txt file, which is located in the /boot/ directory.
But what’s the easiest way to access this file while the Raspberry Pi is still running? And if you have to disconnect to get a microSD card, how are you supposed to edit it? Here’s everything you need to know.
Why do you need config.txt on Raspberry Pi
Such instructions may regulate how the display is detected and the desktop is displayed; config.txt can even be used to overclock a Raspberry Pi. (or return to default clock settings).
Both of these settings are registered in config.txt because neither of them can be changed on a running Raspberry Pi. If the display is not detected, you cannot change desktop settings.
Similarly, if the Pi has been overclocked and won’t boot, or reboots multiple times, you won’t be able to access raspi-config to reset it. Instead, a config.txt file is provided which gives you the option to reset your Raspberry Pi’s clock speed.
It is also possible to change the USB boot mode from config.txt, just like for sound settings.
1. Accessing config.txt from within Raspbian
If you need to edit the config.txt file while Raspbian is running, you can find it. You will find the /boot/ folder in the root directory of the microSD card. Once you’ve found it, just double click to open it and edit it with your default text editor.
However, if you plan to edit the file, it is recommended that you keep the original. Make a copy of the file using your file manager, giving it a different but descriptive name. Once you do this, you can easily restore the original if you run into problems with the edited version.
You can also create a copy in the terminal using
mv config.txt backupconfig.txt
Again, give your copy a meaningful name. Please note that if you edit the config.txt file, the changes will not be applied until you reboot your Raspberry Pi.
2. Edit config.txt Remotely
Rarely connect a keyboard to your Raspberry Pi? As long as the computer is online, you can edit the config.txt file remotely. Do this by connecting via SSH (or VNC or RDP) and navigating to the /boot/ directory. You will need to use