0

I installed InteliJ, and I can run it from the Ubuntu sidebar. Thing is, it runs as a regular user, and me, being a windows user that neglects security on ideological basis :) wants to run it as root. How do I do it? How do I generally find applications that were installed by the snap/GUI installer on the drive, to be able to run it in SUDO?

Basically my question is: Having an application installed and running, how do I locate the command that ran it?

3
  • 1
    What do you gain by running it a root?
    – xenoid
    Oct 4, 2019 at 9:48
  • You can change files on the OS that are owned by root... It's my PC... EVERYTHING is owned by root. I do get that this is a bad practice - security wise. But I don't have NAT open to the internet, nor do I have any server open. So, having to remember another user's password is quite a hassle already, not to talk about chowning, chgrouping, and chmoding :~) I just sudo su...
    – rub
    Oct 4, 2019 at 10:23
  • 1
    @Graham That's a completely different question. This user wants to install something as root, not reinstall sudo...
    – Tim
    Oct 6, 2019 at 12:41

2 Answers 2

0

Try

  • run

    ps -eo pid,args | grep "your_command_name"
    
  • locate your command, take the PID and do

    ls -l /proc/$PID/exe
    

(where $PID is the PID obtained with the firt command)

If you are sure there is no ambiguity, you can even do:

ls -l /proc/$(ps -eo pid,args | grep "your_command_name" | grep -v grep | cut -d " " -f 1)/exe    
2
  • Your answer is problematic because of two things: 1. It's a long command to remember. 2. Who says I remember the command? And in my self answered "community wiki" I wanted to show how easy it is just to show the command using a simple "top c" command.
    – rub
    Oct 4, 2019 at 10:25
  • On Linux, you don't remember commands, you put them in scripts :) But really this answer boils down to two things: 1) using ps + grep is much faster than scanning the whole top output (what if your command isn't using CPU?) and 2) once you know the PID of a process, /proc/$PID/exe is a link to its executable.
    – xenoid
    Oct 4, 2019 at 11:13
0

First, my app was finally found at:

/snap/intellij-idea-community/177/bin/idea.sh

How?

I tried "locate" command, but I didn't know what exactly is the command for starting IntelliJ (the sidebar does not provide it!!! Shame on your Ubuntu Desktop makers. This is basic...). Anyway trying to locate anything using "locate" returns thousands of answers...

So, I thought... why not just run it, and check in the task-manager ("top") and see the command line. Yet, by default top does not show command lines, you need to add the "c" command line, as follows:

top c

Which lists the running apps + the command that invoked them. And so, very easily I was able to see exactly how an app was invoked, and be able to sudo run it :)

And, yes I know smoking gets you cancer. I still want to SUDO, OKAY ?

You must log in to answer this question.

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