I am trying to edit the config.txt file so that I can add the licence codec key codes. I have noobs and Raspbian installed on the Pi.

When I use the text editor that comes with Raspbian to try and edit the config.txt file in the boot directory so that I can enter the commands and codes, it will not let me save the changes. I realise that you need to enter sudo commands as a super user to do this, but can not figure out how to do this. I am very new at programming and Linux so I need instructions for someone with little knowledge of the subject. I am pretty sure that the micro SD card is not write protected, as I was able to configure it and load noobs and Raspbian on to it. What am I missing??


3 Answers 3


You are correct, you need to enter sudo before your command. The simplest way to do this is to:

  1. Open a terminal (look for an icon called Term, the icon is often a black rectangle)
  2. Change to the directory where the file is, using the cd command. Start with cd /'root folder where the file is located' and press enter. For subsequent sub-folders, you won't need the first slash.
  3. Once you are in the folder where the file is located, type sudo 'name of the text editor you want' config.txt Some people use leaf, some people use nano, some people use vi. If the text editor doesn't launch, try gksudo instead of sudo, it's sudo for programs with a GUI.

Raspbian has many text editors!

I assume you are trying to use the GUI editor, but this does not easily allow system files to be edited.

BEFORE you edit the file (indeed ANY system file) you should make a backup of the original. This can be done in a Terminal with sudo cp /boot/config.txt /boot/config.orig.

You CAN edit with one of the terminal editors.

I suggest nano, as this is probably the easiest to edit e.g. sudo nano /boot/config.txt

The other approach is to COPY the file to your HOME directory, and edit it there, after copying the file back.


Ok - now this may be very specific to my situation, but from various forms, I was able to piece together the following solution that worked.

  1. boot up in Raspbian.
  2. click on first overhead tab and then click on accessories and then click on Terminal.
  3. when the terminal screen opens, type "sudo nano/boot/config.txt" without the " marks. This opens the config file in the nano text editor and lets you save your changes.
  4. scroll to the bottom of your config file and enter the command lines as in the e- mail you received when you bought your codex licence.
  5. when you have entered these command lines enter "ctrl w" (by ctrl, I mean the control key)
  6. If asked, enter "y" to acknowledge.
  7. Enter "ctrl X" to exit.

note that you may have to enter 5,6,7 in the command space near the bottom of the screen

Hope this helps others!

---Milliway/ others--Thanks for the repy. I was able to get enough bits and pieces to do it using the nano text editor. I did need very detailed instructions starting from when you boot up the pi (I am quit "rusty" at anything software). This included the non obvious instructions on using the nano text editor as I was quickly able enter the required text at the end of the config file but then - how to save it?? You would think that under "file" you would find a "save" or "save as" to click on but not so in nano. I then had to search "gnu nano commands" to find out how to save my changes. My whole point in posting this is to point out that many people need more detailed instruction than the people that do a lot of programming and that putting those extra steps that one may take for granted can be very helpfull to a lot of new people like me. cheers - have a great day!:-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.