You are not logged in.

#1 2010-01-23 23:45:32

ramboman
Member
Registered: 2010-01-23
Posts: 35

After installing with pacman, where to find the executable

Hello everyone,

I am new to Archlinux and Linux in general. I've been using it for a bit and the pacman utility really ease the installations. Often when I install a new package, to execute the newly installed program, I only have to type in xterm a name quite similar to the package name and the program is executed but sometimes, it is not the case and I'm wondering in which directory I have to look to find the executable.

How do I find the executable of any newly pacman installed program ?

Thanks in advance for the help

Offline

#2 2010-01-23 23:51:31

Coacher
Guest

Re: After installing with pacman, where to find the executable

One of the possible decisions is 'whereis yourprogramname'.
Check the output for /bin or /usr/bin.
Or use 'pacman -Ql yourprogramname | grep bin'

#3 2010-01-24 00:01:20

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: After installing with pacman, where to find the executable

You can use this to find all executable files for a given package:

for ARG in $(pacman -Qql <pkgname>); do [ ! -d $ARG ] && [ -x $ARG ] && echo $ARG; done

Just replace "<pkgname>" with the name of a package.

If you want to add a function to your ~/.bashrc file, you can use this:

function findexe() {
  for ARG in $(pacman -Qql $1); do
    [ ! -d $ARG ] && [ -x $ARG ] && echo $ARG;
  done
}

Source the file then you can invoke it with "findexe <pkgname>".



You could also use pacpal's "--list-exe" option.

Last edited by Xyne (2010-01-24 02:22:53)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2010-01-24 01:16:36

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: After installing with pacman, where to find the executable

Xyne wrote:
for ARG in $(pacman -Qql <pkgname>); do [ -f $ARG ] && [ -x $ARG ] && echo $ARG; done

Just fyi, the -f test is unnecessary here since it's redundant with -x.

Offline

#5 2010-01-24 01:53:08

res
Member
Registered: 2010-01-14
Posts: 55

Re: After installing with pacman, where to find the executable

tdy wrote:

Just fyi, the -f test is unnecessary here since it's redundant with -x.

That's not true.

~ $ [[ -x /etc ]]; echo $?
0
~ $ [[ -f /etc ]]; echo $?
1

But it's still wrong for other reasons:

~ $ touch asd
~ $ ls -l asd
-rw-r--r-- 1 res users 0 Jan 23 21:22 asd
~ $ [[ -f asd ]]; echo $?
0
~ $ [[ -x asd ]]; echo $?
1

Offline

#6 2010-01-24 02:14:04

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: After installing with pacman, where to find the executable

@res: you're right, I didn't think about directories.. but I still don't understand your 2nd point.  I wasn't saying that -f and -x would have the same result.

Offline

#7 2010-01-24 02:27:19

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: After installing with pacman, where to find the executable

As res points out, the "-f" was indeed to avoid directories. His second point is that "-f" will fail to detect symlinks to executables and was unrelated to your post. I suspected that but didn't bother to check. I've changed it to "[ ! -d ...", which seems to filter both regular and symlinked dirs.

Last edited by Xyne (2010-01-24 02:28:21)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#8 2010-01-24 03:09:03

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: After installing with pacman, where to find the executable

Xyne wrote:

His second point is that "-f" will fail to detect symlinks to executables

i still don't see the relation to symlinks, but as long as you get his point..

Offline

#9 2010-01-24 05:12:57

res
Member
Registered: 2010-01-14
Posts: 55

Re: After installing with pacman, where to find the executable

Actually, my point had to do with -f and -x never being redundant. ;)

e: smilie faces

Last edited by res (2010-01-24 05:15:35)

Offline

#10 2010-01-24 05:19:32

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: After installing with pacman, where to find the executable

For some reason I read "ln -s asd" and even though  I thought "but that would lead to a name collision", my brain said "sssssshhhh, it's a symlink, go fix your code".

Funny how things work out.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#11 2010-01-24 09:24:39

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: After installing with pacman, where to find the executable

Xyne is right, but I usually do it a more simple way.

pacman -Ql <package> | grep bin/

This most often suffices, e.g.

bp:~$ pacman -Ql pacman | grep bin/
pacman /usr/bin/
pacman /usr/bin/makepkg
pacman /usr/bin/pacman
pacman /usr/bin/pacman-optimize
pacman /usr/bin/pkgdelta
pacman /usr/bin/rankmirrors
pacman /usr/bin/repo-add
pacman /usr/bin/repo-remove
pacman /usr/bin/testdb
pacman /usr/bin/testpkg
pacman /usr/bin/vercmp

To know or not to know ...
... the questions remain forever.

Offline

#12 2010-01-24 09:50:38

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: After installing with pacman, where to find the executable

I'm with bernarcher, because the OP didn't ask for the libs smile :

$ for ARG in $(pacman -Qql pacman); do [ ! -d $ARG ] && [ -x $ARG ] && echo $ARG; done
/usr/bin/makepkg
/usr/bin/pacman
/usr/bin/pacman-optimize
/usr/bin/pkgdelta
/usr/bin/rankmirrors
/usr/bin/repo-add
/usr/bin/repo-remove
/usr/bin/testdb
/usr/bin/testpkg
/usr/bin/vercmp
/usr/lib/libalpm.so
/usr/lib/libalpm.so.4
/usr/lib/libalpm.so.4.0.3

Offline

#13 2010-01-24 20:05:46

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: After installing with pacman, where to find the executable

res wrote:

Actually, my point had to do with -f and -x never being redundant. wink

you have to think of it in the context of my original thought process.. if a file is known to be executable, it's redundant to test if the file also exists.. obviously i overlooked directories, but we already went over that part..

Offline

#14 2010-01-26 05:20:13

ramboman
Member
Registered: 2010-01-23
Posts: 35

Re: After installing with pacman, where to find the executable

Your advices are really useful. Now, I see my executable. Thanks a lot. smile

Offline

Board footer

Powered by FluxBB