Raspberry Pi

How to access boot config file on Raspberry Pi

A boot in a computer system is a process that tells the computer which instructions and programs should be executed when the computer is turned on. The Raspberry Pi board is also a compact size computer in which a boot is responsible for the behavior of the Raspberry Pi at the time of startup. Now, from where the boot gets the instruction that should be performed at boot time, all instructions are stored in the configuration file of the boot.

To change the behavior of the Raspberry Pi we have to make some changes in the configuration file of the boot and for this, we have to access and edit the configuration file in the boot directory. In this write-up, we have discussed the three different methods to edit the configuration file(conf.txt) file of the boot:

  • Using the terminal of the Raspberry Pi operating system
  • Using the GUI method
  • By accessing the Raspberry Pi remotely

Method 1: How to edit the configuration file of boot on Raspberry Pi using the terminal

To access and edit the configuration file of the Raspberry Pi, first, we have to navigate the “boot” directory using the command:

$ cd /boot

Once we are in the boot directory, we will list down all the contents of the directory to find out the configuration file of the boot:

$ ls

In the above output, we have found a file with the name of “config.txt”, we can open it with any editor as it is a text file, here we will use a nano editor to open this configuration text file:

$ sudo nano config.txt

A file will be open with the text something like this:

REMEMBER: Before making any amendments in the configuration text file of boot, it is considered a good practice to copy all the contents of the file in any backup file so we can undo all the changes, for this we will copy all the data of the “config.txt” in “backupconfig.txt” file using the command:

$ sudo cp /boot/config.txt /boot/backupconfig.txt

For confirmation about the creation of the backup file, again list down the contents of the boot directory:

$ ls

The file “backupconfig.txt” has been created successfully.

Method 2: How to edit the configuration file of boot on Raspberry Pi using the GUI method

The other method to access the configuration file in the boot directory is much more convenient as it’s a graphical user interface method. Click on the “File Manager” icon on the left top of the screen:

Now click on the “boot” present on the left side of the screen:

The boot directory will be opened, now search for the “config.txt” file and open it by double-clicking on it(if you are not a root user then it may ask for the password to access the file):

A configuration file will be opened with the text editor, in our case, it is being opened using the “Geany” text editor:

Method 3: How to edit the configuration file of boot on Raspberry Pi remotely

What will happen if the Raspberry Pi is not connected with any keyboard, mouse, and LCD? Is it possible to edit the configuration text file? Yes! It is still possible to access the configuration text file of the Raspberry Pi remotely from any other computer by connecting it through VNC. For this make sure the VNC is installed on both machines, then open the VNC on the machine from which you want to access it and type the IP address of the Raspberry Pi in the address bar of the VNC:

Type the User name and password of the Raspberry Pi to access it and press on the “OK” button:

The Raspberry Pi is accessed from the other machine using the VNC:

Open the terminal and run the command to access the configuration text file in the boot directory of the Raspberry Pi

$ sudo nano /boot/config.txt

The file is opened for making changes in it:

What to do after making the changes in the boot configuration text file

After making the changes in the configuration file of the boot directory, you have to reboot the system to save the changes made, which can be done by using the command:

$ reboot

Conclusion

If we want to change the behavior of the Raspberry Pi at the boot time, we have to make changes in the configuration file of the boot. The configuration file of the boot is present in the boot directory of the Raspberry Pi with the name “conf.txt”. In this write-up, we have discussed three different methods to access the configuration file in the boot directory of Raspberry Pi to edit it.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.