[TIP] Edit files in 'sudo' mode from terminal

Aliases are really great!

  • Open the terminal (Ctrl Alt t) and enter this line to edit (or create) the alias file:
    gedit .bash_aliases

  • Copy and paste this line:
    alias gs='_gs() { gedit 2> /dev/null admin://"$1" ;}; _gs' # Edit a file with “sudo” permissions

  • Save, close the editor and the terminal.

  • Open the terminal again and type “gs” (as in “Gedit Sudo”) followed by the path to the file you want to edit.
    For example: gs /etc/fstab

What’s more, the terminal won’t complain because you’re launching a graphical application with superuser privileges!

1 Like