In this tutorial we will use
gsettings to set a desktop wallpaper on Ubuntu 20.04 GNOME desktop using command line.
In this tutorial you will learn:
- How to set desktop wallpaper from command line
- How to set Bing search wallpaper
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Set wallpaper on Ubuntu 20.04 using command line step by step instructions
- Just for completeness, retrieve a currently set wallpaper image:
$ gsettings get org.gnome.desktop.background picture-uri 'file:///usr/share/backgrounds/warty-final-ubuntu.png'
- Next, we are going to set some other default Ubuntu wallpaper image as a Desktop background. List all files of the default Ubuntu wallpaper directory:
$ ls /usr/share/backgrounds Beijling_park_burial_path_by_Mattias_Andersson.jpg Flight_dive_by_Nicolas_Silva.png Sky_Sparkles_by_Joe_Thompson.jpg Ubuntu_gel_by_Midge_Mantissa_Sinnaeve.jpg contest Focal-Fossa_WP_4096x2304_GREY.png Stargazing_by_Marcel_Kächele.jpg warty-final-ubuntu.png Ermine_lines_by_Gustavo_Brenner.png Frozen_sunset_on_the_lake_by_Manuel_Arslanyan.jpg Ubuntu_80s_glitch_by_Abubakar_NK.jpg Ermine_Wallpaper_Grey_4096x2304.png Origin_of_nature_by_Julian_Tomasini.jpg ubuntu-default-greyscale-wallpaper.png
- Obtain a full path of the image you wish to set as a wallpaper. For example let’ set
/usr/share/backgrounds/ubuntu-default-greyscale-wallpaper.pngas a default wallpaper.
Next, use the full path of the wallpaper to set new desktop background:
$ gsettings set org.gnome.desktop.background picture-uri file:////usr/share/backgrounds/ubuntu-default-greyscale-wallpaper.png
Your wallpaper should now be changed. In case you see only black or some other single colour wallpaper make sure you got the wallpaper image path correctly and ensure that your new background image is not corrupted.
- (optional) Here is a command line trick on how to set a Desktop background image to Bing’s search wallpaper. The below :
$ wget -O /tmp/wallpaper.jpg "http://www.bing.com/$(wget -q -O- https://binged.it/2ZButYc | sed -e 's/<[^>]*>//g' | cut -d / -f2 | cut -d \& -f1)" $ gsettings set org.gnome.desktop.background picture-uri file:////tmp/wallpaper.jpg