Results 1 to 5 of 5

Thread: How long file was opened

  1. #1
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    181

    Default How long file was opened

    Hello

    I'm curious: is there a way in linux to know for how long a particular file was opened?

    Let's say I'm writing something in KWrite and the file is file.txt
    I'd like to know for how long it was opened in Kwrite (how long I was editing it).
    Or I'm doing subtitles and the file is file.srt and I want to know how much time I spent on it.

    Is it possible to know?
    Linux 4.12.14
    openSUSE Leap 15.0 - 64 bit
    KDE Plasma 5.12.15
    KDE Framework 5.44.0
    Qt - 5.9.4

  2. #2

    Default Re: How long file was opened

    If the application you are using has logging, that may tell you, and
    that's likely the best way to know anything like that for sure. An
    application is probably not likely to hold open an original file (vs. a
    temporary file, which may be similarly-named and be open) for long periods
    of time because that's kind of silly architecturally, and in any case you
    will not see anything about that from the file itself, but may from
    something like the /proc filesystem, auditing systems, or similar.
    Auditing may be your best, application-agnostic, bet, as you could see a
    file-open event, and later on a file-write event after changes are made
    (assuming they are made), but even then you rely on the application
    keeping something open long-term, which isn't a safe assumption for most
    applications.


    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below...

  3. #3

    Default Re: How long file was opened

    If the application you are using has logging, that may tell you, and
    that's likely the best way to know anything like that for sure. An
    application is probably not likely to hold open an original file (vs. a
    temporary file, which may be similarly-named and be open) for long periods
    of time because that's kind of silly architecturally, and in any case you
    will not see anything about that from the file itself, but may from
    something like the /proc filesystem, auditing systems, or similar.
    Auditing may be your best, application-agnostic, bet, as you could see a
    file-open event, and later on a file-write event after changes are made
    (assuming they are made), but even then you rely on the application
    keeping something open long-term, which isn't a safe assumption for most
    applications.


    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below...

  4. #4
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,448

    Default Re: How long file was opened

    LibreOffice records the total editing time in File>Properties. So if you look at this when you start editing and look again just before you close, you can work it out. If you are writing, say, an article, the total editing time will tell you how long it took you to get to the final version.

  5. #5
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    181

    Default Re: How long file was opened

    Thanks.

    I know about LibreOffice. I'm rather interested in other files. Right now I'd like to know my work hours in Gnome Subtitles.
    I was inspired with this feature in Dolphin, where you can right-click on a file and view Properties and there you will find information about the file - Created, Modified, Accessed.
    So I thought it should be simple to get info on time spent on a file.

    To ab - where shall I search for logs (Gnome Subtitles)?
    Linux 4.12.14
    openSUSE Leap 15.0 - 64 bit
    KDE Plasma 5.12.15
    KDE Framework 5.44.0
    Qt - 5.9.4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •