Ubuntu – sudo, gksudo, kdesudo and their differences

gksudosudo

What is the difference between sudo, kdesudo and gksudo, and when should I use each? I know that sudo allows me to run both cli and gui functions, but I've seen other people on websites using kdesudo and gksudo for gui functions.

Best Answer

sudo stands for Super User Do. That means it provide privileges of the root/main user via terminal. Learn more about sudo from its official site.
From Vinicius's comment

It originally stood for 'superuser do' as the older versions of sudo were designed to run commands only as the superuser. However, the later versions added support for running commands not only as the superuser but also as other (restricted) users, and thus it is also commonly expanded as 'substitute user do'. Although the latter case reflects its current functionality more accurately, sudo is still often called 'superuser do' since it is so often used for administrative tasks.

gksudo and kdesudo both are also sudo thing except that first one is use for graphical sudo operation which works using GUI instead of terminal and second one is gksudo alternative for Kubuntu.

And a short note from wiki

You should never use normal sudo to start graphical applications as Root.You should use gksudo (kdesudo on Kubuntu) to run such programs. gksudo sets HOME=~root, and copies .Xauthority to a tmp directory. This prevents files in your home directory becoming owned by Root. (AFAICT, this is all that's special about the environment of the started process with gksudo vs. sudo).

Related Question