alias and which in Ubuntu : moving from Fedora to Ubuntu

Ralf Mardorf silver.bullet at zoho.com
Tue Oct 25 06:26:59 UTC 2016


On my Ubuntu install "which" is a script from "debianutils", on my Arch
Linux install it's a binary, from "GNU which",
http://savannah.gnu.org/projects/which .

You need to install another "which" or much wiser, don't use "which" at
all, since it isn't a portable command.

Next time consider to invest 10 seconds of web research. 

[rocketmouse at archlinux ~]$ cat /etc/issue 
Arch Linux \r (\l)

[rocketmouse at archlinux ~]$ man which | grep "read-alias, -i" -A3
       --read-alias, -i
           Read aliases from stdin, reporting matching ones on stdout. This is useful in combination with
           using an alias for which itself. For example
           alias which='alias | which -i'.
[rocketmouse at archlinux ~]$ tail -n1 .bashrc 
alias which='alias | which -i'
[rocketmouse at archlinux ~]$ which mad
alias mad='LANG=de_DE.utf8 man'
[rocketmouse at archlinux ~]$ which melb
alias melb='meld /root/.bashrc /home/rocketmouse/.bashrc 2>/dev/null'
	/usr/bin/meld
[rocketmouse at archlinux ~]$ sudo systemd-nspawn -qD /mnt/moonstudio
[sudo] password for rocketmouse: 
[root at moonstudio ~]# cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

[root at moonstudio ~]# man which | grep "read-alias, -i" -A3
[root at moonstudio ~]# tail -n1 .bashrc
alias which='alias | which -i'
[root at moonstudio ~]# which mad
Illegal option -i
Usage: /usr/bin/which [-a] args
[root at moonstudio ~]# which melb
Illegal option -i
Usage: /usr/bin/which [-a] args
[root at moonstudio ~]# dpkg -S which | grep /bin/which
debianutils: /bin/which
[root at moonstudio ~]# logout
[rocketmouse at archlinux ~]$ pacman -Qo /bin/which 
/usr/bin/which is owned by which 2.21-2

Regards,
Ralf





More information about the ubuntu-users mailing list