I'm omitting certain files in dired mode using this hook:

(add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))

Is it possible for me to display parent directory .. in the omit-mode ?

2 Answers 2


Yes, the dired-omit-files variable controls this. (Note that C-hf dired-omit-mode RET tells you this.)

I had the same requirement because, although I prefer to use dired-jump when I want to open an additional dired buffer for the parent directory, I regularly use a on the .. entry to replace the original dired buffer with its parent.

I'm also including the advice I wrote to revert (buffer-locally) this behaviour automatically when inserting subdirectory contents, because I realised I never want the .. entry in those listings.

;; Do not omit .. in dired -- it's useful...
(setq dired-omit-files "^\\.?#\\|^\\.$")
;; ...except when we are inserting sub-directories,
;; as it just makes things messy in those cases.
(defadvice dired-insert-subdir (before my-dired-omit-parents)
  "Omit parent .. directories if inserting subdirectories."
  (setq-local dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"))
(ad-activate 'dired-insert-subdir)

That advice does mean that if you refresh the entire buffer after inserting a sub-directory, you once again lose the top-most .. entry. In practice I find this isn't a problem for me, because inserting subdirectories typically means I'm building dired contents that I want to keep around for a while, and therefore I'm unlikely to want to replace that buffer with a different one.

Edit: This Q&A did make me question whether what I really wanted was a convenient way to tell dired-jump to kill the buffer of origin, given that navigating to the .. entry is sometimes annoying. Here's some code to do that.

(defun my-dired-jump (arg)
  "Like `dired-jump', but a single (C-u) prefix arg means \"replace the
current buffer with the target dired buffer\" (i.e. kill the original
buffer). A double (C-u C-u) prefix argument triggers the normal prefix
argument behaviour of `dired-jump'."
  (interactive "P")
   ((equal arg '(4))
    (let ((origin (current-buffer))
          (current-prefix-arg nil))
      (call-interactively 'dired-jump)
      (kill-buffer origin)))
   ((equal arg '(16))
    (let ((current-prefix-arg '(4)))
      (call-interactively 'dired-jump)))
    (call-interactively 'dired-jump))))

(eval-after-load 'dired-x
  '(global-set-key [remap dired-jump] 'my-dired-jump))

You can use options dired-omit-files (mentioned by @phils) and dired-omit-extensions to control what gets omitted by default. You can of course also bind these variables in commands you write. As @phils also mentioned, use C-h f dired-omit-mode as your starting point for information about omitting entries in Dired.

You can also bookmark Dired buffers that you use frequently. If you use Bookmark+ then Dired bookmarks record the current omit settings (and markings and subdir insertions etc.). That gives you a quick way to "jump" to a Dired buffer with particular omit settings.

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.