Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
What is the difference between “gksudo nautilus” and “sudo nautilus”?

I have tiny script that I want it to run on start-up, but it needs sudo privileges so I use gksudo for the job. but it fails. (it works correctly using sudo.) Is there any difference between sudo and gksudo beside the inteface?

BTW: this is the tiny script I mentioned:


cat /sys/devices/platform/sony-laptop/kbd_backlight|if read state; then \
    echo $((1-$state)) | sudo tee /sys/devices/platform/sony-laptop/kbd_backlight; fi;
share|improve this question

marked as duplicate by fossfreedom Jul 15 '12 at 15:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

As you might have guessed, I'm total newbie! –  Untitled Jul 15 '12 at 14:59
See this question askubuntu.com/q/11760/61218 –  Anwar Shah Jul 15 '12 at 15:04
Thank you. I've seen it. But I don't see how $HOME parameter affects my code. –  Untitled Jul 15 '12 at 15:20
@fossfreedom I don't think this is an exact duplicate: this question has an issue similar to mine: my script fails with gksudo, but works with sudo, whereas the other does not involve scripts. I am not a total newbie, but I don't see how my script is affected by anything discussed in the other question. –  sage Aug 6 '12 at 21:07

1 Answer 1

The main difference is as follows :

gksudo : is used to run graphical (GUI) applications as root
sudo : is used to run command line applications as root

share|improve this answer
And why? I'm a typical dumb user and saw that typing "sudo" is just enough to run even graphical applications with root rights. So I use sudo and save two letters of typing. Except if you can convince me why I should type two more letters ;) –  DebugErr Jan 27 at 10:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.