System: Linux Mint 18.1 64-bit Cinnamon.Bash: Packaged version 4.3.46(1)-release.Objective: To define Bash aliases to launch various CLI and GUI text editors while opening a file in root mode from gnome-terminal emulator.Progress: For example, the following aliases work as expected:For CLI:alias sunano='sudo nano'For GUI:alias suxed='sudo xed'They both open any file as root.Problem: I have an issue with gksudo in conjunction with sublime-text:alias susubl='gksudo /opt/sublime_text/sublime_text'Sometimes it works. It just does not do anything most of the time.How do I debug such a thing with inconsistent behavior. It does not output anything. No error message or similar.
Starting text editors from terminal as root
gksu;sublime text
You shouldnt run an editor as root unless absolutely necessary, you should set sudoedit up appropriately. Then you can doSUDO_EDITOR=/opt/sublime_text/sublime_text -w sudoedit yourfilesudoedit will check youre allowed to do this, make a copy of the file that you can edit with changing ids, start your editor, and then, when the editor exits, copy the file back if it has been changed.Id suggest a function rather than an alias:function susubl {    export SUDO_EDITOR=/opt/sublime_text/sublime_text -w    sudoedit $@}although as Jeff Schaller pointed out, you can use env to put this in an alias and avoid changing your shells environment:alias susubl='env SUDO_EDITOR=/opt/sublime_text/sublime_text -w sudoedit'(The -w option ensures that the Sublime Text invocation waits until the files are closed before returning and letting sudoedit copy the files back.)