LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Finding the command line to launch an application from a terminal. (https://www.linuxquestions.org/questions/linux-newbie-8/finding-the-command-line-to-launch-an-application-from-a-terminal-757782/)

cricballa 09-25-2009 02:53 PM

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.

John VV 09-25-2009 03:26 PM

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 "

catkin 09-25-2009 03:36 PM

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.

i92guboj 09-25-2009 04:00 PM

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 :p

pbharris 09-25-2009 04:29 PM

for RPM based systems:
rpm -qa

cricballa 09-25-2009 05:08 PM

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.


All times are GMT -5. The time now is 11:13 AM.