Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I want to cd to the directory of go's bin file:
$ type go
go is /c/tools/go/bin/go
How can I quickly cd to this directory in bash ?
cd $(dirname $(which go))
which go will show the path of the executable. Then get the dirname of that path and cd to that.
which go && cd $(dirname $(which go))