So, you have just flashed your Raspberry Pi OS image to your SD-card. Now, you need to make some basic configuration settings.
This is typically done by entering
which will give you a main and several sub menus to enter your display settings for your Pi.
These menus are slightly different depending on the Pi Model that you have and may evolve with a major Raspberry Pi OS update. Older instructions may, therefore, point to the wrong number and confuse beginners – and sometimes advanced users alike.
While clicking the menu option is not hard at all, it’s faster and easier doing it via the command line.
In this article, I will show you the key commands that you typically need when setting up your software for a digital picture frame.
Where the configuration settings are stored
The configuration setting are not stored in one place but spread across various files, symbolic links, and systemd services.
Only the display setting are stored in a config.txt in the /boot directory.
You can call it up with
cd /boot && nano config.txt
This command opens the file in a read-only mode. If you want to modify it, you have to add “sudo” before the “nano”.
Close the file with CTRL+X.
The terminal commands for frequently used settings
So here are the commands that I use most often. The general syntax is
sudo raspi-config nonint
followed by the command. As you can probably guess, “noint” stands for “non interactive” which means that there is no menu.
This applies to all commands, except for the password change.
Change User Password
sudo passwd pi
on the command line. This is assuming that your user name is “pi”.
Enter your new password and confirm it.
Change your hostname
After a fresh installation, the hostname of every Raspberry Pi is “raspberrypi”. Most people probably want something a bit more customized.
So if you want to change your host name to e.g. “pictureframe” enter
sudo raspi-config nonint do_hostname pictureframe
You will have to reboot after this change.
Change your boot options
You can instruct your Pi to either boot into the text-based console or the graphical user interface desktop. Additionally, you can ask for a password at boot, but I assume here that you would want an automatic login.
To choose the Console Autologin enter
sudo raspi-config nonint do_boot_behaviour B2
To choose the Desktop (GUI) Autologin enter
sudo raspi-config nonint do_boot_behaviour B4
Wait for network at boot
I recommend activating this setting to make sure that your network is properly mounted and the Internet connection established before the boot process is completed. You specify a timeout in seconds, so if the network cannot be found, it will still boot, albeit slower.
The command for a 30 seconds timeout is
sudo raspi-config nonint do_boot_wait 30
If the display on your screen is not completely filled, you will need to disable Overscan.
This is done by typing
sudo raspi-config nonint do_overscan 1
Putting a “0” instead of the “1” add the end, will enable it again.
Specify GPU Memory
Some graphic programs, like my recommended Pi3D image viewer, need a minimum amount of allocated GPU Memory. By default, this is set to 64MB. Pi3D requires 128MB, if you want to connect a 4K monitor on the Raspberry Pi4, I recommend to set it to “256MB”.
To check what your current GPU settings are, enter
sudo raspi-config nonint get_config_var gpu_mem /boot/config.txt
To set it to 128MB, enter
sudo raspi-config nonint do_memory_split 128
Set the Timezone
You should always set the correct time zone, as timer triggered event like those defined in crontab or systemd depend on it.
The command for Sidney would be
sudo timedatectl set-timezone Australia/Sydney
Input your region (Africa, America, Asia, Australia, Europe, Indian, Pacific, UTC) followed by the capital of your country or state.
Other examples are
sudo timedatectl set-timezone Europe/Berlin sudo timedatectl set-timezone Europe/Paris sudo timedatectl set-timezone Europe/London sudo timedatectl set-timezone America/New_York sudo timedatectl set-timezone America/Los_Angeles sudo timedatectl set-timezone Pacific/Auckland
For a full list of available time zones enter
I wonder what the logic behind these timezones exactly is. Sometimes, the capital of the country is used, sometimes the largest city (e.g., for Nigeria, Lagos is shown instead of Abuja. And not to mention “Sacramento”…). But I am sure that hours of valuable committee discussions at the United Nations went in the process of determining them.
Locale specifies language, country, characters, and sorting order. It is an important setting of you want to have e.g. filenames with special characters displayed properly.
Locale is easy to specify. Enter
sudo nano /etc/locale.gen
and you will get a long list that looks like
# en_SC.UTF-8 UTF-8 # en_SG ISO-8859-1 # en_SG.UTF-8 UTF-8 en_US ISO-8859-1 # en_US.ISO-8859-15 ISO-8859-15 # en_US.UTF-8 UTF-8 # en_ZA ISO-8859-1 # en_ZA.UTF-8 UTF-8 # en_ZM UTF-8 # en_ZW ISO-8859-1 # en_ZW.UTF-8 UTF-8 # eo UTF-8
Look for your country and language and remove the “#” (including the space) to add it. I believe you can have as many as you like.
Save the file with CTRL+O and exit with CTRL+X.
While a password or time zone change will not require a reboot, most of the other options do, so it’s always safe to
once you are done.
All these commands are documented in the GTK version of raspi-config which is an application that allows the configuration of Raspberry Pi system settings. It is a great source for finding the terminal command for every raspi-config menu item from the GUI. And you can study the original raspi-config script on Github. If you copy it into a text editor like Sublime it is much easier to read as it shows colors.
While you can always use the “sudo raspi-config” command to enter the menu settings, I found it faster to make changes via the command line.
Especially, if you repeatedly need to make the same changes, you can just combine several commands with “&&” (one space before and after), so you just have one line that you need to copy, e.g.
sudo raspi-config nonint do_hostname pictureframe && sudo raspi-config nonint do_boot_behaviour B4 && sudo raspi-config nonint get_config_var gpu_mem_128 /boot/config.txt && sudo raspi-config nonint do_boot_wait 30
Just copy & paste a line like the above into the Terminal, and you make four changes in one go. No more climbing around in the menu structure.
- Check the wifi signal strength of your Raspberry Pi digital picture frame before you hang it up on the wall
- How to automatically remove duplicate images from your Raspberry Pi digital frame photo library
- How to start realtime systemd timer services as a crontab replacement on the Raspberry Pi
- The ultimate guide on using systemd to autostart scripts on the Raspberry Pi