I just upgraded my Ubuntu 16.04 to 17.04 and found a little problem with cd
command.
Let's say that I have two folders: album-01
& album-02
In Ubuntu 16.04, if I do cd album*
it will go to the first folder found album-01
But in new Ubuntu 17.04, if I do cd album*
it result me
-bash: cd: too many arguments
How to make cd
in Ubuntu 17.04 like cd
in Ubuntu 16.04?
Best Answer
I couldn't test this on a real 17.04 system yet (only verified that it works on 16.04), but you should be able to override the
cd
Bash built-in command with your own custom function, which discards any additional arguments except the first one:Update: As suggested in @muru's comment, this version below might work better and support calling
cd
without arguments though:After you have entered this line above in your terminal, please verify whether
cd
now behaves in the way you want. If this is the case, you can make this function definition persistent by appending that line to the end of your~/.bashrc
file. Otherwise it will vanish as soon as you end your current shell session.Note that if for whatever reason you temporarily need to use the real
cd
Bash built-in command instead of this custom function, you can simply call it withcommand cd
instead of plaincd
.