Questions tagged [dired]

Dired is a major mode that allows users to edit files and directories on a file system. It is essentially a file browser, with a wide range of features and an appearance similar to the `ls` command.

Filter by
Sorted by
Tagged with
55
votes
5answers
11k views

Edit file with super-user rights

When you have to edit system files, it's an usual situation that you launched Emacs with a normal user before, so the file will be write-protected. What can I do to gain root privileges? I mean ...
48
votes
1answer
13k views

How to quickly copy/move file in Emacs Dired?

In Dired mode, I can m mark files and R to move them to a destination. Some times the destination path is too long. With the destination open in a split window, is there a way to move files quicker? ...
39
votes
7answers
16k views

Tree-based directory browser?

I love dired, but sometimes (particularly when filming screencasts) I want to see the tree-structure of a directory and its children, a la the tree(1) command. Is there a tree-oriented directory ...
31
votes
5answers
3k views

Is there a way to use query-replace from grep/ack/ag output modes?

I'm aware of find-grep-dired, marking the corresponding files and then pressing Q to run dired-do-query-replace-regexp on the marked files. Unfortunately that requires restarting the grep and no ...
23
votes
8answers
4k views

Close all dired buffers

Sometimes my buffer list has 10+ dired windows, and I end up using buffer-menu to manually mark and kill all of them. Is there a faster way to close all open dired windows?
19
votes
7answers
2k views

Dired “quick-view” key to preview the file at point

I would like to create a function that does a "quick view" of a file the is under point in dired. The way that I would like for this to work is that I hold down a function key, which then makes the ...
19
votes
4answers
1k views

How to set emacs as the default file manager?

Some programs like firefox have buttons that when clicked open a file manager for browsing files. How do I make it to open in emacs with dired mode on Debian Linux?
18
votes
2answers
3k views

Current path in Dired or Dired+ to clipboard

Say we have a Dired buffer open on some directory. How can I send the directory path to the clipboard? Also, how can I do the same when the Dired cursor is on a specific file, without opening the ...
14
votes
3answers
2k views

Dired+ missing from MELPA

I am trying to install dired+ from MELPA but it seems that it no longer is listed. I also checked here: https://melpa.org/ Is this normal?
14
votes
1answer
276 views

In dired buffers, place point on the most important file of that directory

90% of the time I visit a directory in Emacs, the first thing I do is move point to a specific file and open it. A lot of times, the file I need to open is very predictable. For instance: If there ...
13
votes
1answer
2k views

how to deal with ZIP archives in DIRED?

I want to work easier with archives in Emacs dired-mode. And I think that my needs are not only mine. What I want? Two things in Dired: z to zip file or dir on cursor (or all marked files/dirs if ...
12
votes
1answer
472 views

Display recursive folder sizes in-line in dired?

I'd like to display the recursive size (the value that would be reported by du) of folder contents in-line in the dired buffer as an additional column or in place of the directory file size. Is this ...
11
votes
1answer
472 views

How to stop dired printing “Reverting buffer …”

After setting dired-auto-revert-buffer to t, even when I'm working on a buffer of file that may produce some results, the message keep printing if there is a dired buffer behind current buffer. This ...
10
votes
2answers
491 views

Programmatically insert files into Dired buffer

I have a list of file names (with full path) and I want to create a Dired buffer listing this set of files. How would I go about doing that? How do I create a Dired buffer from a list of file names? ...
10
votes
3answers
485 views

Sort file names (numbered) in dired

When Dired sorts files by name, it sorts in alphabetical order. That's fine with letters; however, when the file names start with numbers, it would be better to sort in numerical value. Example: ...
10
votes
1answer
3k views

Tramp/Dired transfers files inline over ssh instead of using scp externaly

I am using tramp via ssh to access remote files. For text files, this is working really well, but whenever I want to copy larger remote files to my local machine, tramp uses its slow inline method (...
10
votes
3answers
420 views

Get all filenames in current Dired buffer with Elisp

As the title suggests, how do I get all the file entries in a Dired buffer using Elisp?
10
votes
2answers
2k views

Dired as an FTP client

I don't know whether this is possible or not. I know I can edit remote files, but what I am looking for is a setup like this: one buffer with dired on my local directory one buffer with dired on the ...
10
votes
1answer
543 views

How to use Dired marked files as arguments to arbitrary Emacs Lisp functions?

Dired lets me mark files and pass their names as arguments to arbitrary shell commands. I would like a way to supply the marked names as arguments to Emacs Lisp functions, either built-in or those I ...
9
votes
4answers
3k views

Recursively open files matching regexp in marked directories

Generally speaking, I would like to be able to open all files within a given set of directories (and their subdirectories) where the filename matches a given regexp. For example /home/nispio/...
9
votes
6answers
3k views

Simple ways to copy/paste files and directories between dired buffers

Is there a simple M-w C-y approach to copy paste files and directories between two dired buffers? I mean marking some items (files and buffer) by m then copying them by M-w (or another shortcut), ...
9
votes
2answers
616 views

How can I create a dired buffer listing all open files?

I have a mechanism for burning items to disc from a dired buffer. Unfortunately, the file's I've patched are strewn accross the file system. How can I create a dired buffer from all open files?
9
votes
2answers
362 views

How can I make Dired buffer names include the full path?

I often have many dired buffers open, including some for folders that have identical names. Occasionally, this causes me to switch to the wrong one, so I am looking for a way to fix this. Currently, ...
9
votes
2answers
207 views

How to avoid typing “space” after “^” for moving up in directory in dired?

^ is the key binding for moving to the parent directory in dired ("Up directory"). However, in Gnu Emacs on Windows 7 Professional 64-bit with my German keyboard layout, it is not sufficient to type "...
9
votes
2answers
2k views

Finding files by names

How can I bring all files with names that conform a specific regex, recursively in a directory tree, to a single dired buffer? So I can rename/delete them all at once?
9
votes
3answers
1k views

Dired: only reuse buffer for directories

To prevent creation of a buffer every single time I enter a directory in dired I use this: (put 'dired-find-alternate-file 'disabled nil) My problem now is that when I visit a file from dired ...
9
votes
4answers
3k views

Emacs: how to open and play a video file

If I am exploring my file system in Dired-mode and I come across a video file, for example, it would be nice to be able to play that video file. How can I do this in Emacs? I can use Emacs to open a ...
9
votes
1answer
295 views

How to prevent tramp locations from interfering in history?

I have an issue where if I try to perform some random Emacs operations such as org-capture, or renaming a file to a different (local) directory in dired, Emacs attempts to contact a different machine ...
8
votes
4answers
1k views

How can I run a keyboard macro in selected buffers from Ibuffer or selected files from dired?

If I have to do some variable name refactoring, I use ag and multiple-cursors. But when I have to do some code block removal/addition/moving, I use keyboard macros. But I need to switch to each ...
8
votes
3answers
575 views

Search and replace through a multifile project in AUCTeX?

I am about to adopt Emacs to be the only editor I use in all what I am writing including LaTeX documents. I came from WYSIWYG editor which served that purpose fairly nice, namely TexStudio or TXS for ...
8
votes
1answer
815 views

dired - sort and hide by default

More often than not, when I open a dired buffer, I press ( to run dired-hide-details-mode s to rundired-sort-toggle-or-edit What's a good way to have these done automatically every time I open a ...
8
votes
3answers
2k views

How to use “o” to open from dired/ibuffer into another frame

I have two windows open and split vertically (single frame): A) contains my work B) contains either dired or ibuffer. I would like to be able to navigate to a file/buffer in pane B and hit "o" ...
7
votes
2answers
960 views

Dired. First show list of folders

Windows 10, Emacs 25.1, Dired+ Here example of my folder's content: As you can see the files and folder are mixed. But I want first to show list of folders and after show list of files. Is it ...
7
votes
3answers
1k views

Expanding Dired to show subdirectories/files?

One of the biggest things I miss from other editors (e.g. Sublime, Intellij) is the ability to see the project structure, and expand/minimize directories as needed so I can see what I care about. Is ...
7
votes
4answers
810 views

The C-x C-j binding for dired-jump stopped working

I used to have a keyboard shortcut for the following action: "Open the folder containing this file in Dired+, and place point (cursor) on the file" I believe it was C-x C-j, and I don't recall ...
7
votes
3answers
1k views

How can I visualize VCS status in dired?

I'm particularly concerned with git, but I imagine this is a good place to use vc. I want to emulate Atom's git integration with its file explorer: How can I get something like this in dired? I ...
7
votes
1answer
674 views

Is it possible to load Dired+ automatically with use-package?

I'm trying to add dired+ to my init.el with use-package but I can't seem to find the name of dired+ on any of the package repositories ( marmalade, melpa or elpa ). I'd been able to add dired+ after ...
7
votes
1answer
816 views

Why doesn't (use-package dired) work for me?

(use-package dired) complains: Debugger entered--Lisp error: (error "Package ‘dired-’ is unavailable") But I see others' emacs configurations do use (use-package dired), for example: https://github....
7
votes
1answer
456 views

How can I add default shell commands for various file types?

When I use ! on a *.tar.bz2 file in Dired, I'm presented with the following prompt: ! on WANem_3.0_Beta2.tar.bz2: {3 guesses} [bunzip2 -c * | tar xvf -] -!- How can I add similar functionality for ...
7
votes
1answer
218 views

Marking files in dired with subdirectories

I'm trying to mark a set of files (including subdirectories' files) in dired matching a regex, so I do: C-U C-x d -alR RET e:/ RET Followed by %m and enter my regex. No matches. If, however, I ...
7
votes
3answers
1k views

Open file from dired in the same window — using the mouse

How do you configure emacs to open a file in the current window -- using the mouse -- when it is selected from a dired buffer? That is, when I open a directory and then select a file with the mouse ...
7
votes
2answers
419 views

How to always kill dired buffer when deleting a folder?

If I'm in dired and have a subfolder with another dired buffer (a common situation when navigating up/down directory) and want to delete a folder, I hit Dx to mark for deletion, then execute. Emacs ...
7
votes
3answers
318 views

Dired heading directory with text-properties to jump to parent directories

Speedbar has a nice feature wherein the directory heading at the top of a files/directory buffer contains various text properties for the user to jump to any of the parent directories by placing the ...
7
votes
1answer
158 views

Is it possible to open .iso file in emacs dired?

When I open .iso file in dired, I have to mount it a temp folder mount -t iso9660 foo.iso temp then navigate to that folder, read the files. Is it possible to open .iso file in dired directly? (...
7
votes
1answer
303 views

Insert all subdirectories in Dired

How can I insert all the subdirectories of the toplevel directory in Dired? And how can I insert the whole directory tree, i.e. all the subdirectories recursively? I don't want to change the default ...
6
votes
2answers
1k views

How to mark all files in the current dired directory?

I want to mark all the files in the current dired buffer. Is there a command for this? Not including . and ... My use case is hardlinking all the files in a directory and I always reach for M which ...
6
votes
4answers
405 views

Copy all file names that match regexp

In a dired buffer of a directory, how do I copy the file names of all files matching [tT]ypolog[yi]? Getting them from an elisp list format, \n separated format or otherwise into a python list format ...
6
votes
3answers
761 views

How to grep marked files in the dired mode of emacs?

I hope it's a simple problem.. I'd like to search for the regexp 'thisWord' only in the marked files of a dired buffer. Usually I used in the dired buffer: M-x grep and then in the mini-buffer grep ...
6
votes
4answers
834 views

Quickly jump to favorite folders

What I actually want I have deep folder structures and use about a dozen folders pretty far down the directory tree a lot. In Nautilus, I use bookmarks to get to them quickly. I want the same thing ...
6
votes
1answer
394 views

Follow symlinked directories in Dired

On a Linux machine I symlink some directories into my home directory like this: /home/mrdarcy: total used in directory 231 available 520120 drwxrwxr-x 3 4k 04-30 18:16 bin drwxr-xr-x 2 4k ...