Here is how to edit file as root in Ubuntu and how to open and edit a file in Linux terminal. Using nautilus admin, edit text file as root Ubuntu.
Ubuntu – run as administrator GUI option
Run the following commands in terminal to add “Open As Administrator” option to right menu in Ubuntu.
sudo apt-get update
sudo apt-get upgrade
sudo apt install nautilus-admin
nautilus -q
Once installed, you can easily open file/folders as root (super user privilege) in Nautilus file