52

The list view of Nautilus 3.6 shows the dates files were modified in a variety of ways: the hour and minute if modified on the current day, and the month and day if modified during the current year, and the year tacked on if modified during a previous year. I would like to see the entire date and time consistently on all the files (e.g.: Sat 20 Apr 2012 01:28:34 PM EDT).

I had this set up before, but I can't figure out how to do so with version 3.6. I did find this question, but the answers no longer apply to Nautilus 3.6: How to change the date format in Nautilus list columns?

How can I do so in Nautilus 3.6+?

Fern Moss
  • 8,785
  • Looking at the settings on precise and raring they are identical so I am assuming it is a feature removed from nautilus there maybe a plugin or script that can re-add it though. – Davmor2 Apr 26 '13 at 11:58
  • 3
    the date-format key in gsettings was removed by this commit: https://git.gnome.org/browse/nautilus/commit/libnautilus-private/org.gnome.nautilus.gschema.xml.in?id=73465be3671ae572ba744d36b055fda3cb210db7 which belongs to this bug report: https://bugzilla.gnome.org/show_bug.cgi?id=676898 – djfun Apr 26 '13 at 12:39
  • 3
    A link to a "bug" asking that the functionality be restored: https://bugzilla.gnome.org/show_bug.cgi?id=699055 – Fern Moss Apr 27 '13 at 18:22
  • Happening to me on v3.14.2. A person named Carlos commented in https://goo.gl/AE7FRA that this is fixed in nautilus v3.16. – AlikElzin-kilaka Apr 06 '16 at 12:57
  • @AlikElzin-kilaka Can anyone confirm whether this was fixed or not? In the Nautilus that ships with Ubuntu 16? – a06e May 31 '16 at 20:05
  • 1
    @becko Ubuntu 16.04 ships with Nautilus 3.14. It is not fixed in that version. I have not tested 3.16. – Fern Moss Jun 01 '16 at 01:38
  • Switch to Thunar. – Dustin Oprea Feb 09 '17 at 20:54
  • What about now? Any fixes on this? – a06e Sep 29 '17 at 13:45

4 Answers4

26

You can get back the full date by recompiling nautilus:

sudo apt-get build-dep nautilus
sudo apt-get install quilt
export QUILT_PATCHES=debian/patches
apt-get source nautilus
cd nautilus*
quilt new 999_full_dates.patch
quilt edit libnautilus-private/nautilus-column-utilities.c

Change line 77 from

"attribute", "date_modified",

to

"attribute", "date_modified_full",

Rebuild and install modified package:

quilt refresh
fakeroot dpkg-buildpackage
cd ..
killall nautilus
sudo dpkg -i nautilus_*.deb
nautilus &

As always, you have to perform these steps every time there is an update for nautilus in Ubuntu.

Now, a full analysis of the problem:

The actual patch which caused this change is this one.

The function nautilus_file_get_date_as_string gains an extra gboolean parameter "compact" - when true the abbreviated date is returned.

This function is never called directly - it is accessed through the wrapper function nautilus_file_get_string_attribute_q. This function takes attribute parameters like "date_modified". To accommodate the new signature of nautilus_file_get_date_as_string a new attribute is added "date_modified_full". After this change, any code in nautilus which uses the file date string will get the abbreviated date.

Finally, the file properties dialog is updated to use "date_modified_full" attribute.

So in order to have nautilus display the full date in list view, it is only necessary to change one line of code: in libnautilus-private/nautilus-column-utilities.c, line 77 from "date_modified" to "date_modified_full".

A slightly more useful patch could add a new column type which would show the full date, making this an optional feature, and only add 10 lines of code.

Pablo Bianchi
  • 15,657
  • 16
    This is why I love open source - when the developers go crazy, I can fix it myself. – Alistair Buxton Apr 26 '13 at 18:58
  • 1
    This is why I love open source - people like you can fix things when developers go crazy. Thank you! – Fern Moss Apr 27 '13 at 00:36
  • One minor downside: now if you type home into the dash the home folder it doesn't show up. Typing the username still works though. Not sure why this is, but it's a pretty minor issue. – Fern Moss Apr 27 '13 at 18:21
  • It doesn't show up for me either. I have an unpatched nautilus installed. I don't see how this change could cause a difference in the dash. Can you test with unpatched nautilus please? – Alistair Buxton Apr 28 '13 at 02:04
  • Yeah, you are right, it doesn't show up for me now. I now wonder if it ever did in 13.04? Not a big deal, but odd. – Fern Moss Apr 30 '13 at 20:36
  • 7
    Is this currently still the only way to handle this issue? – Philippe Jul 09 '13 at 17:13
  • 4
    @AlistairBuxton Have you tried submitting the second patch to the Gnome developers? It would be great if they could at least give us a choice instead of keeping the full date unavailable… – n.st May 11 '14 at 14:46
  • 4
    I no longer use Nautilus and I suggest you do the same. – Alistair Buxton May 11 '14 at 15:24
  • 2
    Has this been fixed in more recent versions (so that I don't have to recompile)? – a06e May 31 '16 at 20:04
  • 2
    What about now? Any updates? Ubuntu is dropping Unity in favor of GNOME, sure some things have changed. – a06e Sep 29 '17 at 13:44
19

This blog post shows a much easier solution. It is based on creating an extension which can be selected as an alternative "modified column". Tested under 16.04.

  1. gedit ~/.local/share/nautilus-python/extensions/longdate.py

  2. Use this code (always copy code you trust):

    #!/usr/bin/env python
    

    import os import urllib import datetime from gi.repository import Nautilus, GObject

    class ColumnExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoProvider): def init(self): pass

    def get_columns(self):
        return (Nautilus.Column(
            name="NautilusPython::Longdate", 
            attribute="longdate", 
            label="Longdate", 
            description="Get long date"),)
    
    def update_file_info(self, file):
        if file.get_uri_scheme() != 'file':
            return
    
        filename = urllib.unquote(file.get_uri()[7:])
        statbuf = os.stat(filename)
        formatteddate = datetime.datetime.fromtimestamp(statbuf.st_mtime).strftime('%Y-%m-%d %H:%M:%S')
        file.add_string_attribute('longdate', str(formatteddate))
    

  3. chmod +x ~/.local/share/nautilus-python/extensions/longdate.py

  4. sudo apt install python-nautilus

  5. nautilus -q and nautilus . to restart Nautilus and see if it properly loads the extension.

  6. Select the new "Longdate" column in the list column preferences.

The result will look like this:

example

Pablo Bianchi
  • 15,657
bluenote10
  • 1,885
  • 1
  • 18
  • 23
  • 4
    First install nautilus-python: sudo apt-get install python-nautilus – DrMoishe Pippik Aug 26 '18 at 04:47
  • 1
    Thanks a lot - it seems to work in Disco - Ubuntu 19.04 ! But you can not sort by Longdate. Unfortunately I can not fix that myself. Great job anyways. As @Alistair Buxton said: This is why I love open source - when the developers go crazy, I can fix it myself. Well, with your help! THX. – opinion_no9 Jan 13 '19 at 13:22
  • This isn't working on Nautilus ("Files" 3.10.1) on Ubuntu 14.04. When Nautilus is started from command line, it says Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory Please ask sysadm to enable user sharing. Then six times ** (nautilus:21161): CRITICAL **: nautilus_menu_provider_get_background_items: assertion 'NAUTILUS_IS_FILE_INFO (current_folder)' failed. The would-be new column doesn't show in the choices. – wallyk Feb 20 '19 at 15:02
  • Thanks ! Works for me under Bionic (18.04.4 LTS), Nautilus 3.26.4 and nautilus-python 1.1-6. – Mutos May 02 '20 at 09:54
  • Here is another solution you should only use if you read it or trust it. – Pablo Bianchi Nov 24 '20 at 03:56
  • Even though you can't sort by Longdate, you can still show the useless Modfied column and sort by that. – Jim Rhodes Oct 10 '22 at 13:18
  • Ubuntu 22: the package was replaced by python3-nautilus and unquote was moved under parse - so you need to do urllib.parse.unquote instead of just urllib.unquote, (+ import urllib.parse) otherwise still works :-) didn't figure out the sorting yet... Also it doesn't seem to work in the Icon View Captions. For sorting I just display "Modified --- Time" too and sort by that - which effectively sorts this column too :-) – jave.web Sep 10 '23 at 21:36
6

For those using trusty & not wishing to compile I've set up a test ppa for a patched nautilus. (using Alistair Buxton's patch

The build currently also includes 2 bug fix patches, 1 from trusty-proposed, 1 from utopic.

Additionally there are 3 minor patches that have been tested by me over quite some time & pose no issues.

  1. open with on folders

  2. real file owner name displayed instead of "Me"

  3. File Manager as name of launcher

The 'date-time' patch I've tested a bit, seen no issues. For those inclined to try - if any issue found contact me thru launchpad email.

The "Modified (full)" column can be added thru nautilus in listview > View > Visible Columns.. or thru nautilus > Edit > Preferences > List Columns

https://launchpad.net/~mc3man/+archive/nauty-mods

Read ppa page for info & how to easily revert if need be.

doug
  • 17,026
  • I can't seem to get this nautilus version installed. sudo apt-get install nautilus just concludes that latest is already installed. Trying sudo apt-get --reinstall install nautilus reinstalls, but the very same that there already is. Do you by any chance have something for e.g. /etc/apt/preferences.d/ that makes this thing actually get installed, or how else to do it? (on Trusty) – Hannu Jan 23 '16 at 15:11
  • @ Hannu, try again, needed to be updated – doug Jan 23 '16 at 20:47
  • dpkg --list | grep nautilus showed the ...+date version. Retried, several times. Only after having rebooted with this version installed, then delved into the Terminal and there after using nautilus --no-desktop (unsure if it appeared there) and then nautilus --force-desktop I - at last - found the "Modified (full)" option in the list view. Now it seems to be present at all times. question: Can the content be modified? e.g. I'd hope as for use of "strftime()" ? – Hannu Jan 24 '16 at 15:09
  • Hmm... might it be LC_TIME=... that specifies the format? – Hannu Jan 24 '16 at 15:22
  • @ Hannu, no clue as to why you found the list view option so 'hard' to find, no such issues here. As far as modifying, well download the debian.tar.xz file from ppa, you'll find the date-time.patch inside the patches folder, have at it. – doug Jan 24 '16 at 15:26
  • 1
    An unprejudiced request for next time you update the ppa, please consider adding yet another format for the Modifed column; same as date +'%Y-%m-%d, %T' – Hannu Jan 30 '16 at 13:41
4

Nemo is a fork of Nautilus that includes Creation date and a button for Ctrl+L.

sudo apt install nemo

To replace Nautilus for Documents links etc.:

xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search

That updates your mime settings:

$ cat ~/.config/mimeapps.list |grep inode
inode/directory=nemo.desktop
inode/directory=exo-file-manager.desktop;
$ cat /etc/gnome/defaults.list |grep inode
inode/directory=org.gnome.Nautilus.desktop