LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-01-2012, 02:56 PM   #1
jarimany
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Rep: Reputation: Disabled
Getting Application name from process name or pid


I need help getting the application name from it's process name or pid.

The most I found is the process name, i.e "soffice" , but what I need is the application name, i.e. "Open Office", is there a way to do it in linux?

I don't mind using shell scripting, python or C / C++.


Thanks in advance
 
Old 11-01-2012, 03:26 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You could try query package management nfo if available / possible but AFAIK there is no distro-agnostic, foolproof way to accomplish that.
 
Old 11-02-2012, 03:27 AM   #3
jarimany
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I've tried with aptitude and I don't find how to relate the application name to the process name.
any idea?

I also would need to do the same with rpm

thanks
 
Old 11-02-2012, 06:43 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Code:
redhat() { rpm -qf "$1" --qf="%{name}\n"; }; debian() { dpkg -S "$1"; }
find /proc/[0-9]* -maxdepth 1 -type l -iname exe | while read ITEM; do 
 TARGET=$(readlink -f $ITEM); [ -z $TARGET ] || { redhat $TARGET; debian $TARGET; }
done
 
  


Reply



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
[SOLVED] How to save the pid of a process at the time of process startup jhonnappier2007 Linux - Newbie 13 11-20-2011 11:54 PM
about pid of process hamedn Programming 2 01-27-2010 05:21 PM
how to get the name of process from PID in C/C++? kulandaivelu Programming 3 02-03-2009 09:41 AM
How to get the PID of the process giving kill signal to a process? hariprd Programming 2 11-27-2008 03:10 AM
[C++] Get process ID (PID) Moraxus Programming 5 10-16-2008 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:33 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration