LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-25-2009, 02:53 PM   #1
cricballa
Member
 
Registered: Jan 2007
Posts: 33

Rep: Reputation: 15
Finding the command line to launch an application from a terminal.


Is there a way to find out the currently installed packages and the corresponding command line to launch the package from a terminal. For example, I know that I have openoffice installed but I do not know how to find the command line to launch it.
 
Old 09-25-2009, 03:26 PM   #2
John VV
Guru
 
Registered: Aug 2005
Posts: 12,663

Rep: Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682Reputation: 1682
OO is an odd one in that a start up script launches it

but for most programs it is just the name
for example
The Gimp 2.6 is " gimp "
Firefix 3.5 is " firefox"
OO 's "word" is = " openoffice.org -writer %U ", or the program name -- " oowriter "
 
Old 09-25-2009, 03:36 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,528
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
If you are using ubuntu you can find installed applications by using
Code:
dpkg -l
It will produce a lot of output so you may want to redirect it to a file for browsing later
Code:
dpkg -l > /tmp/dpkg.out
You can install apt-file and then use it to list all the files in a given package
Code:
apt-file update
apt-file list <package name>
apt-file update takes a long time to run. apt-file list will list many files; application executable files are probably in /usr/bin, /usr/local/bin or somewhere under /opt.

The apropos command finds many commands but not all and you have to be inventive about the keyword. If it lists some commands related to what you are interested in you could use the type command to find their location and then list files in the same place. guessing some part of the name as in this example
Code:
c@CW8:~$ apropos office
o3read (1)           - convert files in OpenOffice.org format.
o3tohtml (1)         - convert files in OpenOffice.org format.
o3totxt (1)          - convert files in OpenOffice.org format.
update-openoffice-dicts (8) - rebuild dictionary.lst for OpenOffice.org
c@CW8:~$ type o3read
o3read is /usr/bin/o3read
c@CW8:~$ ls /usr/bin/*office*
/usr/bin/openoffice.org3  /usr/bin/openoffice.org3-printeradmin  /usr/bin/soffice
As it happens I know that soffice is the main OOo executable; on ubuntu there is a man page for it
Code:
man soffice
If you can start the application from the GUI you can use the ps command to find which command lines are being run
Code:
c@CW8:~$ ps -f -uc
UID        PID  PPID  C STIME TTY          TIME CMD
[snip]
c        23923     1  0 01:46 ?        00:00:00 /bin/sh /opt/openoffice.org3/program/soffice -writer file:///home/c/Desktop/CW8%20ubuntu%20software%20log.odt
c        23933 23923  3 01:46 ?        00:00:25 /opt/openoffice.org3/program/soffice.bin -writer file:///home/c/Desktop/CW8%20ubuntu%20software%20log.odt
c        24176  8067  0 01:57 ?        00:00:00 sleep 2m
c        24190 23832  0 01:58 pts/0    00:00:00 ps -f -uc
-f asks for a full listing and -uc asks for for processes belonging to user c. The PID (process ID) and PPID (parent process ID) connections are informative.
 
Old 09-25-2009, 04:00 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
I assume you can still right click the menus and launchers on kde or gnome to see where a given icon or item is pointing to, so that's a way to find the right command for a given program, however I don't use any DE myself so I am not sure
 
Old 09-25-2009, 04:29 PM   #5
pbharris
Member
 
Registered: Apr 2001
Location: chicago, IL
Distribution: debian, redhat
Posts: 280

Rep: Reputation: 30
for RPM based systems:
rpm -qa
 
Old 09-25-2009, 05:08 PM   #6
cricballa
Member
 
Registered: Jan 2007
Posts: 33

Original Poster
Rep: Reputation: 15
Thanks guys. The suggestions really helped. I now have a fair idea. I tried two methods to get the command line and both worked. That is,

Ran the application from GUI and then ran ps -f -uc command (where c is the username)

I also right clicked on the icon of the application on my desktop and looked at the properties. It also gave me the command line that launched the application.

Thank you all once again.
 
  


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
How do I resize the terminal window from the command line in the gnome terminal QuIcKSpArK Linux - Newbie 5 04-21-2012 02:04 PM
How to launch Krfb using the command line? bnj Linux - Networking 5 11-06-2009 08:08 AM
How do I launch a Java applet using the command line? jacatone Linux - Software 1 01-17-2009 11:01 PM
How do you launch Mozilla Firefox from the command line ? pppaaarrrkkk Linux - Newbie 1 10-07-2005 02:06 PM
gnome: launch application associated to a document type from command line cweiske Linux - Software 1 09-28-2004 06:47 PM


All times are GMT -5. The time now is 08:25 PM.

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