If I open dired buffer with filename as parameter, and not directory, only that one file is displayed in dired mode. But I wish I could open dired buffer like that (dired "/usr/bin/pwd") and see not only one pwd entry, but all other files and subdirectories, and cursor will be on pwd.

That is the default behavior of dired-jump, and I wish I could somehow do the same for ordinary filepath, and not current buffer.


1 Answer 1


C-h f dired-jump tells us:

dired-jump is an interactive autoloaded compiled Lisp function in dired-x.el.

It is bound to C-x C-j.

(dired-jump &optional OTHER-WINDOW FILE-NAME)

Jump to Dired buffer corresponding to current buffer.

If in a file, Dired the current directory and move to file’s line.

If in Dired already, pop up a level and goto old directory’s line.

In case the proper Dired file line cannot be found, refresh the dired buffer and try again.

When OTHER-WINDOW is non-nil, jump to Dired buffer in other window.

When FILE-NAME is non-nil, jump to its line in Dired.

Interactively with prefix argument, read FILE-NAME.

So you can get what you request using C-u M-x dired-jump or just C-u C-x C-j.

If you don't want to hit C-u each time, you can define your own command that does the same thing without hitting C-u:

(defun my-dired-jump (&optional other-window file)
  (interactive (list nil (read-file-name "Jump to Dired file: ")))
  (dired-jump other-window file))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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