I am having some strange issue with Kate and Kwrite. When I click on Open File, it crashes with segmentation fault.

I am a complete newbie to Linux, and I think the issue is that I am not running the application as root.

How do I run applications as root in Ubuntu? Is it bad practice to do this? What is the purpose of the whole root thing, where even though we need to use root so frequently, it is not utilized as default?

  • You can do some very damaging things when using root to open an editor so please do not go that way ;) 2 other solutions that do not require root: try and fix the segmentation fault or use another editor (gedit is gnome's editor). kate en kwrite are KDE program (so not Gnome).
    – Rinzwind
    Oct 28, 2012 at 6:46
  • 1
    what damaging things can be done w text editor.sounds crazy Oct 29, 2012 at 3:05
  • 1
    @АртёмЦарионов For one thing, as root you can edit files your computer uses to start up the operating system or load your graphical environment, effectively breaking your computer.
    – Amanda
    Feb 24, 2014 at 15:23

5 Answers 5


It is pretty simple to run a program as root.

For a console program use

sudo <program name>

If it is a GUI application use

gksudo <program name>
  • -bash: gksudo: command not found
    – markshep
    Jul 23, 2023 at 12:43
  • It may have been removed by default in debian based distros. You can install it with sudo apt install gksu, but it isn't strictly required. You can still use sudo for a gui app.
    – Goddard
    Jul 24, 2023 at 16:05

UNIX-like operating systems (including Linux) use a concept called privilege separation to ensure that the system stays safe. UNIX was designed as a multi-user system from the ground up - that is, it was designed so that many people could use one computer running UNIX at once. Because most users don't need to be able to modify the core system only the system administrator should have that privilege. That privileged user is traditionally called root. (Root is a lot like Administrator in Windows.)

This makes sense on several levels. Commonly, a web server or other process that exposes a port to other (possibly malicious) computers will run as its own user (Apache runs as the user nobody), so that even if the web server program is hacked, the attacker can't trash the entire machine quite so easily. It even makes sense for mostly single-user machines such as desktops: if other members of your family, for example, somehow manage to run rm -rf / (do NOT run that), they won't have permission to delete every file on the system, like they would if there were no such thing as privilege separation.

There are several commands you can use to elevate your privileges. The sudo command exists to temporarily give you root-level privileges when you need them to administer the system. You can also use the commands gksudo or su. The latter can be used only if you know root's password and is a good option if your account doesn't have permission to use sudo.

The root user can do anything on a system, with almost no exceptions. So even if you request something by accident, it will be carried out with little or no warning, even if it's bad for the health of your system. This is why it's good practice to do most of your activities as a normal user, and use root only when needed, like when you're installing a program.

You shouldn't need to use root to get rid of a segmentation fault. If root is the only thing that fixes a segfault, then the program has a bug. Programs should not fail like that just because they don't have root.

  • I have experienced this kind of error and normally it has been to do with a file permission. Using root is like taking a sledgehammer to crack a peanut. Better to identify the file and decide if you change the ownership or permission as needs. For example I have an admin group for files that others shouldn't need to update or access.
    – will
    Feb 13, 2018 at 12:22

In addition to the previous answer, which says about sudo and gksudo, yes, it is definitely a bad practice to run a program as root unless this is an administrative one.

Please try to find you why the programs are crashing. Please seek help of others if you need to.


You can also go to /usr/share/applications in ubuntu and edit the launch file of the application you are trying to run.
Like i edited the file of github atom, normally i use a wildcard to find the files like this

sudo nano atom*

This will open the atom.desktop file, now find the Exec command and prepend gksudo.For eg.,


Exec=/usr/share/atom/atom %U  


Exec=gksudo -k -u root /usr/share/atom/atom %U

Now whenever the application is launched it will ask for root password.

  • well I can't see such file in Tomcat server. I have to run GUI app in this way: "sudo ./manager-linux-x64.run" everyday, which i know is not a good thing to do. But pkexec is not working on this app.
    – Pranav
    Jan 17, 2020 at 5:37

If you get error like this:

sudo: program-name: command not found

when calling it this way:

sudo program-name args

For example:

sudo dotnet run --configuration Release
sudo: dotnet: command not found

You can get path to a program by using

which program-name

And then use that path:

sudo path_to_program args


sudo $(which dotnet) --configuration Release

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .