The system did what you asked. Opening the file in nano
, which is a small editor that can run in the terminal. It will also run in a text console, which is very useful in case the graphical environment is broken.
The command for the graphical editor in Ubuntu is gedit
. However, you cannot just change nano
in your command. That would start the graphical editor with elevated permissions, i.e., as root. In some cases, running a graphical program with elevated permissions (as root) can affect the file permissions in your home, and may cause problems. Also for reasons of security, running a graphical application as root is discouraged and is being deprecated. Therefore, never use the sudo
command to run graphical applications. Only use sudo
for terminal commands.
The currently supported way of editing system files with a graphical editor is by using the admin://
URI. Thus, open your system file /etc/fstab
with the following command to edit it with root privileges in a safe way:
gedit admin:///etc/fstab
A graphical dialog appears where you should submit your user password. The very first time in a session, you you are asked two times in a row.
Through this mechanism, you are editing a temporary copy of the system file as a regular user. Once you hit save, the system file is being updated.
See some alternative methods to edit files with GUI editors in the link.
And one more thing, yesterday I had ubuntu installed, then after following this (I think it was the reason) sudo gedit /etc/fstab my machine stuck in the bootscreen. Then I reinstalled ubuntu :(
– Mostakim Jan 29 '21 at 16:09