LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 01-12-2007, 11:19 AM   #1
q0987
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Rep: Reputation: 0
How to check the command for the loaded application?


hello all:

When I 'Open Terminal' and use command 'ps -e', I could find
a process called gnome-terminal in my Red Hat Enterprise 4.0.

Then after inputing the command 'gnome-terminal' on the prompt,
I can 'Open Terminal' by using command directly rather than using menu.

However, when I select 'Computer' on my desktop and open it,
I don't know which process it belongs to.

Is there a general method that I could use to find the current
loaded GUI application so that later I could open the same application
by using command directly?


Thank you
 
Old 01-12-2007, 11:49 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
There are two ways to accomplish this: look at the desktop icon properties or use the ps command. One problem, if you are using KDE, is that many applications are run by the KDE kicker applet. When you use the ps command in a terminal window the line is too long to display the actual application name in the default 80 columns. Unfortunately the ps command truncates it's output at 80 columns by default. You can get around this by telling the ps command that you have a wide screen. If you do that then the ps command will not truncate the output at its default of 80 columns. Often this wider output will be enough to see the real name of the application.
Code:
ps -w 132
You may need to tell the ps command to show all of the processes running under your account, or any account name. You can use the -U parameter to see that.
Code:
ps -w 132 -U username

Last edited by stress_junkie; 01-12-2007 at 11:54 AM.
 
Old 01-12-2007, 12:13 PM   #3
q0987
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by stress_junkie
There are two ways to accomplish this: look at the desktop icon properties or use the ps command. One problem, if you are using KDE, is that many applications are run by the KDE kicker applet. When you use the ps command in a terminal window the line is too long to display the actual application name in the default 80 columns. Unfortunately the ps command truncates it's output at 80 columns by default. You can get around this by telling the ps command that you have a wide screen. If you do that then the ps command will not truncate the output at its default of 80 columns. Often this wider output will be enough to see the real name of the application.
Code:
ps -w 132
You may need to tell the ps command to show all of the processes running under your account, or any account name. You can use the -U parameter to see that.
Code:
ps -w 132 -U username
I use GNOME.
I check the properties for 'desktop' icon but I see nothing.
This method works if I create a customized desktop icon where I
could find the command in the launcher tab of the properties window.

I open the 'Desktop' application and run
ps -e -U q0987 and I got the following message:

>> ps -e -U q0987 > t1.txt
then i close the 'desktop' application
>> ps -e -U q0987 > t2.txt
>> diff t1.txt t2.txt
no difference.??

any new ideas?


Thank you again
 
Old 01-12-2007, 12:33 PM   #4
FnordPerfect
Member
 
Registered: Dec 2006
Location: Germany
Distribution: Kubuntu (Feisty Fawn), Debian (SID)
Posts: 127

Rep: Reputation: 15
There is no such thing as "the 'Desktop' application". It is just another instance of an already running process (in your case probably the Nautilus file manager); that is why you don't see a difference in the process table.

you could use the xprop command. check its output for useful information about GUI programms

try $ xprop | grep WM_CLASS and click on a window you want to get more info about. WM_CLASS seems to contain very often the shell command behind a window.
 
Old 01-12-2007, 01:45 PM   #5
q0987
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by FnordPerfect
There is no such thing as "the 'Desktop' application". It is just another instance of an already running process (in your case probably the Nautilus file manager); that is why you don't see a difference in the process table.

you could use the xprop command. check its output for useful information about GUI programms

try $ xprop | grep WM_CLASS and click on a window you want to get more info about. WM_CLASS seems to contain very often the shell command behind a window.

The results from tricking the above command:

[root@ics132-73 ~]# xprop | grep WM_CLASS
WM_CLASS(STRING) = "nautilus", "Nautilus"

Then I run the command 'nautilus' and get a GUI similar as
when I open the 'Computer' icon on my desktop.

The content inside this new window with title "root" is as follows:
Desktop anaconda-ks.cfg firstboot.1168480778.23 install.log install.log.syslog

The content inside the 'Computer' window is as follows:
Floppy Drive CD-RW/DVD-ROM FileSystem Network


THx
 
Old 01-12-2007, 02:51 PM   #6
FnordPerfect
Member
 
Registered: Dec 2006
Location: Germany
Distribution: Kubuntu (Feisty Fawn), Debian (SID)
Posts: 127

Rep: Reputation: 15
Ok, I see what you are up to...

When you click the Computer icon, it opens another instance of Nautilus at a "special locaction". This location tells Nautilus to display special content.

When you just execute the nautilus command from a terminal, it opens nautilus as a normal file manager for the current working directory -- /root, the folder you are in.
(by the way, don't fiddle around with your system as root! use your normal user account instead!)

I don't have Nautilus installed, so I can't test it, but you should be able to give nautilus this "special location" as an argument on the command line.

This special location is called a URI (Universal Recource Indicator), and is used in all kinds of applications.

Have a look here:
http://www.theevilpixel.com/?q=node/77

These are some URIs nautilus understands. Try some of them out.
Type for example $ nautilus "start-here:///" in a terminal and see what happens...

Last edited by FnordPerfect; 01-12-2007 at 02:54 PM.
 
Old 01-12-2007, 03:43 PM   #7
q0987
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Hello FnordPerfect:

Thank you so much for your helps

The command to open 'Computer' GUI is as follows:

>>nautilus computer:///


Best wishes
 
Old 01-14-2007, 10:55 AM   #8
xjlittle
Member
 
Registered: Aug 2003
Location: Indiana
Distribution: fc6 sles9 & 10 kubuntu ubuntu-server
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
It took me awhile to grasp where he was headed with this-but that's pretty cool. I can already see some uses for that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bcm43xx is loaded -- but how to check if the card is detected? vharishankar Linux - Hardware 5 12-14-2006 04:54 AM
Check application visibility 3saul Programming 9 02-13-2006 08:43 PM
application loaded at startup rob_xx17 Linux - General 2 10-26-2005 08:16 PM
What command to see which kernel is loaded? Nu-Bee Linux - General 2 10-30-2003 07:36 PM


All times are GMT -5. The time now is 01:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration