You are not logged in.
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
One of the possible decisions is 'whereis yourprogramname'.
Check the output for /bin or /usr/bin.
Or use 'pacman -Ql yourprogramname | grep bin'
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 Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
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
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
@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
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 Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
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
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
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 Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
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
I'm with bernarcher, because the OP didn't ask for the libs :
$ 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
Actually, my point had to do with -f and -x never being redundant.
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
Your advices are really useful. Now, I see my executable. Thanks a lot.
Offline