Going to the direcory of a file as fast as posible [duplicate]

Is there a way to get to the path of a file as fast as possible and in the least amount of keystrokes.

Context:
Type cd and then paste the path of a file and then have to go back and hit backspace until the path reflects a directory.

I’m think of something like <cd> directory/directory2/file.file and it takes me to directory2, maybe even something like Ctrl+w just that only deletes “file.file”, I know that cd is part of the shell, I’m currently switching from bash to zsh, so if the answer is zsh friendly it would be even better.