Categories
Linux Mastering Development

Which binary would be run when we have multiple installations?

I wanted to set gsettings as /usr/bin/gsettings so I created an alias. But I am not sure if that works:

$ type gsettings
gsettings is aliased to `/usr/bin/gsettings'
gsettings is /home/linuxbrew/.linuxbrew/bin/gsettings
gsettings is /usr/bin/gsettings

$ which gsettings
/home/linuxbrew/.linuxbrew/bin/gsettings

Also another example:

$ type pandoc
pandoc is aliased to `/usr/bin/pandoc'
pandoc is /home/linuxbrew/.linuxbrew/bin/pandoc
pandoc is /usr/bin/pandoc
pandoc is /home/nikhil/.cabal/bin/pandoc

$ which pandoc
/home/linuxbrew/.linuxbrew/bin/pandoc

Question

  1. Can someone please clarify which binary for pandoc and gsettings would get executed when I type pandoc and gsettings on bash?

  2. Does the order of output of type command has some significance?

Note

$ type type
type is a function
type () 
{ 
    builtin type -a "$@"
}
type is a shell builtin

Leave a Reply

Your email address will not be published. Required fields are marked *