3

Setting the CDPATH variable is very useful, but it results in some not very nice result: each time I use the cd command, the full path of directory I want to move is printed.

For example, if I am in my home directory and want to change directory to Desktop, result will be following:

~$ cd Desktop
/home/user/Desktop
~/Desktop$

This is kind of annoying, so my question is: how to avoid printing the path like this?

2

Setting the following alias should do it:

alias cd='>/dev/null cd'

This drops the output that cd would print on a successful, CDPATH-using directory change, while still printing error output when changing directories fails.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.