16

When dealing with large files in Midnight Commander, I have difficulties counting the digits to get the order of magnitude of the file size (hundreds of MB, or tens of GB, etc.).

Sometimes, I use the trick to press the Insert key, which highlights the file and shows the file size in a nicely formatted way (i.e., as a number with digit group separators; e.g., 123,456,789), which makes it much more readable.

I am wondering if/how I could set up MC to show the file size in this format by default, in the Size column.

I assume this has nothing to do with locale.

user1968963
  • 4,083
  • 1
    Related MC ticket: https://midnight-commander.org/ticket/3165 Ticket #3165 Display human readable sizes in panels – StackzOfZtuff Dec 09 '22 at 08:53
  • Of course this request *is* locale-sensitive.  Specifically, in the Indian locale (set LANG or LC_NUMERIC to en_IN or en_IN.UTF-8, for example), 123456789 is displayed as “12,34,56,789”. – G-Man Says 'Reinstate Monica' Dec 14 '22 at 03:01

1 Answers1

14

You can adjust the displayed digits with the column size option, see the “Listing mode” section in the manual. The file to edit is ~/.config/mc/panels.ini.

To list the file sizes as K, M or G use a narrow size column using the user_format key:

[New Left Panel]
user_format=half type name mark size:4 space mtime

If you want the size without abbreviation, reserve enough space for it:

[New Right Panel]
user_format=half type name mark size:16 space mtime
Marco
  • 33,548
  • 1
    but this will not display the filesize as: 123,456,789 – user1968963 May 23 '13 at 17:01
  • You didn't exactly specify what you want, you said “nicely formatted”. What is wrong with this, is it the missing comma? – Marco May 23 '13 at 17:23
  • 1
    123,456,789 is what I would like to have – user1968963 May 23 '13 at 17:43
  • You should add, that the changes are only visible by setting the Listing mode for each panel to custom. Left -> Listing mode... -> (*) User defined: – loki Apr 04 '19 at 10:57
  • after edited the ~/.config/mc/panels.ini i start the mc but it doesn't show as you said? do I need to run something like source ~/.bashrc to notify mc to update the config? – Luke Jan 20 '20 at 09:18
  • I wanted to know how to make mc display file sizes in human-readable format. This answer does exactly that. Thanks @Marco. – likewise Mar 28 '21 at 14:52