I'm connected through SSH. In other words, I have no mouse nor keyboard connected to the unit. How do I change the wallpaper from the terminal?


You can set the Raspberry Pi desktop background with this command under Pixel (lightdm) Desktop Manager:

pcmanfm --set-wallpaper="/your/background/file"
  • for some reason this has serious trouble running with su... I can ssh to pi and run it, but I can't ssh to another user, sudo su pi and then run it. pcmanfm somehow remembers the original user and fails to detect it's already running. env DISPLAY=:0.0 pcmanfm -w '/home/pi/Pictures/wallpaper.jpg'
    – Ray Foss
    Oct 18 '19 at 19:40
  • My workaround is to set the wallpaper to a file, replace that file with my wallpaper using the same name, then sudo killall -9 pcmanfm. Something in the pi makes it restart when it crashes... conveniently. Voila, your wallpaper has been updated remotely... or with crontab
    – Ray Foss
    Oct 18 '19 at 21:23

From http://lxlinux.com (section 5 on the page):

 In a traditional set-up wallpaper can be changed by terminal launching a wallpaper GUI: 

   pcmanfm --desktop-pref,

or by directly editing the .conf files in ~/.config/pcmanfm/LXDE/. The default wallpaper folders depend upon the distribution and are generally /usr/share/backgrounds or /usr/share/lxde/wallpapers.

Sounds like you need to look at the .conf files in the ~/.config/pcmanfm/LXDE/ folder.

  • Thank you. There are backgrounds in those folders indeed, but none of them is the one I see. So now I'm confused about where my wallpaper might be located. Apr 24 '15 at 21:41
  • Have you checked the .conf files for references to wallpaper settings? the other folders are just the location of default wallpapers available on the system. I don't have my rPi available to check, but on Lubuntu (also using LXDE) I can find the background setting in ~/.config/lxpanel/Lubuntu/panels/panel under the "Global {..}" section (it's called "Backgroundfile").
    – Phil B.
    Apr 25 '15 at 1:14
  • backgroundfile doesn't seem to be the right thing. Points to a totally different file but not what I've set as beackground Aug 29 '16 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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