0

I'm trying to add a program path /usr/bin/xscreensaver-demo, to file so my screensaver will start at boot. But I can't save it. I don't have the permission to change it and save it. I have tried this in both Brackets and gedit.

/etc/rc.local:

# By default this script does nothing
/usr/bin/xscreensaver-demo
exit 0

I thought of using a sudo command in the terminal but I don't know what command to execute to edit that file with superuser privilege and save it.

David Foerster
  • 36,264
  • 56
  • 94
  • 147

1 Answers1

0

First you'll need a text editor. Ubuntu comes with gedit by default. To run gedit with sudo privileges type sudo gedit filepath . Then you'll be asked for your sudo password, enter it and gedit window will open allowing you to edit and save the file.

If you know how to use vi/vim (even knowing how to insert/save and quit is enough) you can do the same by sudo vi filepath This opens the file in your terminal.

Seems that i'm pretty wrong here.

Courtesy of @steeldriver Why should users never use normal sudo to start graphical applications?

@GTRONICK says > For gtk applications you should use gksudo .