Ubuntu – suppose you need to make changes to a file which is not user-editable. Or you have an installation script that must be run as root. The most commonly offered solution is to fire up a terminal, change into the directory containing the file and type
sudo gedit filename
However, there is a solution that does not involve the terminal at all. Use File Browser to get to the file, right-click on it, and select Open with Other Application…
Expand Use a custom command at the bottom of the Open with window to reveal a text entry field, and type
if you want to open a text file, or simply
to launch a script.
Click Open. A standard password-entry window will pop up, and after you enter your password, your file will open with root access.