On Mon, Jan 16, 2017 at 4:42 AM, <to...@tuxteam.de> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Sun, Jan 15, 2017 at 09:47:40PM -0500, kamaraju kusumanchi wrote: >> How can I find out the display manager currently running on a machine >> from the command line? > > Hm. How do you know there aren't two running? Or fifteen?
Thanks for the detailed reply, Tomas. For the first round, I am happy if I can get the display manager from which the current user's session is initiated from. Background on why I need this: I am developing a script[1] that gathers relevant system information depending on what issue a debian-user is facing. For example, if the user says "audio is not working", it will show sound card information. If the user says "setting up wireless on debian", it will fetch information on wireless card. If the user says "unable to install package X", it will show how /etc/apt/sources.list is currently setup etc., The idea is that before posting to debian-user mailing list, the user will run this script and copy paste the output in the initial email, so we do not see trivial replies such as "What is your video card or what distribution are you running or are there any errors in /var/log/Xorg.0.log" etc.,. The idea is similar to reportbug which automates gathering dependency information when reporting a bug against a package. But the focus here is to help users ask smart questions. The script is not yet ready. It only works for sound related tasks for now. But my plan is to extend it for other categories such as video, wireless, apt related problems. [1] - https://gitlab.com/d3k2mk7/rutils/blob/master/debian_user/gather_system_info.py > Have a look at this tree snippet from my machine, obtained by > "ps wauxf" (I snipped most of the columns and shortened things > a bit): Thanks. It looks like all I need is to find the parent process of Xorg. In my case, that would be lightdm. root 2605 0.0 0.1 287812 5804 ? SLl Jan15 0:00 /usr/sbin/lightdm root 2705 9.7 2.6 411116 106552 tty7 Ssl+ Jan15 92:07 \_ /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch root 3635 0.0 0.1 250596 6344 ? Sl Jan15 0:00 \_ lightdm --session-child 12 21 rajuloc+ 3645 0.0 0.0 4296 1524 ? Ss Jan15 0:00 \_ /bin/sh /usr/bin/startkde rajuloc+ 3673 0.0 0.1 116044 6240 ? S Jan15 0:13 \_ /usr/bin/xbrlapi -q rajuloc+ 3722 0.0 0.0 11084 328 ? Ss Jan15 0:00 \_ /usr/bin/ssh-agent /usr/bin/im-launch /usr/bin/startkde rajuloc+ 3814 0.0 0.1 72172 4708 ? S Jan15 0:00 \_ kwrapper5 /usr/bin/ksmserver > If you have control on your whole environment, you can make your life > easier and set up your session to export a shell variable (the session > above is this process with the funny name "-:0", which parents everything > running under X in my box). There are admin-settable things in the session > machinery (mainly in /etc/X11/xinit/, as shell script snippets which are > dot-included (remember? they want to be able to set env vars) at start, > and branch out, as needed, to per-user script snippets. I do not see any "-:0" process in the output of ps wauxf. So may be it is a system specific thing that can't be relied upon? -- Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog