Emacs dired mode is an easy to use text-based file manager. By default, files are displayed in alphabetical order. Is there a way to sort the files by file size descending order?
Dired makes an Emacs buffer containing a listing of a directory, and optionally some of its subdirectories as well. You can use the normal Emacs commands to move around in this buffer, and special Dired commands to operate on the listed files. Dired works with both local and remote directories.
With Dired, you can mark files for deletion using the d key. Once you have selected the files you want to delete, you can type x to initiate the deletion process. You will be prompted with a warning and must type yes or no to complete or abort the deletion.
Open dired for a directory containing files you want to work with. Then use C , R , or D when the cursor is on the line of a file to copy, rename/move or delete the file, respectively. This can also be done for multiple files by marking them.
You may customize the sort order by providing an argument to the dired-sort-toggle-or-edit
which is bound to the s keystroke.
So to answer your question, just type Control+u s and pass the -lS
switches.
You may pass -lhS
for human readable results.
You might want to use the extension dired-quick-sort. After setting it up, push "S" to display a sorting menu that offers many different ways to sort, including file size.
Disclaimer: I am the author of the extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With