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
Set wallpaper on Ubuntu 20.04 using command line
Set wallpaper on Ubuntu 20.04 using command line

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - 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

  1. 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'
    
  2. 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
    

  3. SUBSCRIBE TO NEWSLETTER
    Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


  4. 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.png as 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.
  5. (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
    
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions