My format is whereis directory | cd
but I get no output (not even a warning).
Where as you have other posts that require variables, my question asks how to do it without them.
My format is whereis directory | cd
but I get no output (not even a warning).
Where as you have other posts that require variables, my question asks how to do it without them.
So on CentOS the whereis command prefixes the output with your search.
[root@JBCLAMP001 ~]# whereis bin
bin: /usr/local/bin
So I came up with the following that seems to work in my testing so far:
cd $(whereis bin | awk '{print $2}')
Some directories will have multiple locations which may or may not be an issue. For example on my machine the rpm
directory has 4 locations. The above cd command still works but it will cd you to the first listed location and not inform you that there are more.