How to get the last modified time if the content is modified
Clash Royale CLAN TAG#URR8PPP
In Ubuntu if the user is not having permission to write a file but if he tries to change, the last updated time of that file will change(even after getting write error: Operation not permitted). So, I wanted the last modified time of the file if the user successfully save or modified the content is that possible.
linux ubuntu
add a comment |
In Ubuntu if the user is not having permission to write a file but if he tries to change, the last updated time of that file will change(even after getting write error: Operation not permitted). So, I wanted the last modified time of the file if the user successfully save or modified the content is that possible.
linux ubuntu
1
Can you give a minimal example for the claim "the last updated time of that file will change even after getting write error". For me (16.04, ext4), this is clearly not the case. Which file system?
– RoVo
Feb 27 at 12:22
@RoVo actually an editor that saves a R/O file can save a new copy, remove the R/O file (possible since the parent directory is R/W) and then rename the new copy (and set it R/O). But I agree that the OP should describe the use case more clearly (even though I have little hope that there is a solution to this).
– xenoid
Feb 27 at 12:32
But then it is a new file, and this does not happen after a write error.
– RoVo
Feb 27 at 12:33
add a comment |
In Ubuntu if the user is not having permission to write a file but if he tries to change, the last updated time of that file will change(even after getting write error: Operation not permitted). So, I wanted the last modified time of the file if the user successfully save or modified the content is that possible.
linux ubuntu
In Ubuntu if the user is not having permission to write a file but if he tries to change, the last updated time of that file will change(even after getting write error: Operation not permitted). So, I wanted the last modified time of the file if the user successfully save or modified the content is that possible.
linux ubuntu
linux ubuntu
asked Feb 27 at 12:16
vikramvikram
1032
1032
1
Can you give a minimal example for the claim "the last updated time of that file will change even after getting write error". For me (16.04, ext4), this is clearly not the case. Which file system?
– RoVo
Feb 27 at 12:22
@RoVo actually an editor that saves a R/O file can save a new copy, remove the R/O file (possible since the parent directory is R/W) and then rename the new copy (and set it R/O). But I agree that the OP should describe the use case more clearly (even though I have little hope that there is a solution to this).
– xenoid
Feb 27 at 12:32
But then it is a new file, and this does not happen after a write error.
– RoVo
Feb 27 at 12:33
add a comment |
1
Can you give a minimal example for the claim "the last updated time of that file will change even after getting write error". For me (16.04, ext4), this is clearly not the case. Which file system?
– RoVo
Feb 27 at 12:22
@RoVo actually an editor that saves a R/O file can save a new copy, remove the R/O file (possible since the parent directory is R/W) and then rename the new copy (and set it R/O). But I agree that the OP should describe the use case more clearly (even though I have little hope that there is a solution to this).
– xenoid
Feb 27 at 12:32
But then it is a new file, and this does not happen after a write error.
– RoVo
Feb 27 at 12:33
1
1
Can you give a minimal example for the claim "the last updated time of that file will change even after getting write error". For me (16.04, ext4), this is clearly not the case. Which file system?
– RoVo
Feb 27 at 12:22
Can you give a minimal example for the claim "the last updated time of that file will change even after getting write error". For me (16.04, ext4), this is clearly not the case. Which file system?
– RoVo
Feb 27 at 12:22
@RoVo actually an editor that saves a R/O file can save a new copy, remove the R/O file (possible since the parent directory is R/W) and then rename the new copy (and set it R/O). But I agree that the OP should describe the use case more clearly (even though I have little hope that there is a solution to this).
– xenoid
Feb 27 at 12:32
@RoVo actually an editor that saves a R/O file can save a new copy, remove the R/O file (possible since the parent directory is R/W) and then rename the new copy (and set it R/O). But I agree that the OP should describe the use case more clearly (even though I have little hope that there is a solution to this).
– xenoid
Feb 27 at 12:32
But then it is a new file, and this does not happen after a write error.
– RoVo
Feb 27 at 12:33
But then it is a new file, and this does not happen after a write error.
– RoVo
Feb 27 at 12:33
add a comment |
1 Answer
1
active
oldest
votes
The command stat
gives you that information. You can see three timestamps. Access, Modify and Change. By (succesfuly) reading the file, Access is modified. By changing for example the permissions, Change is modified. If the content is changed, Modify is changed. Take a look at this:
#case@maru:~/temp:[0]$ rm test
#case@maru:~/temp:[0]$ echo test>test;stat test
File: test
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:39.715956782 +0000
Change: 2019-03-04 17:52:39.715956782 +0000
Birth: -
File created. All the timestamps are the same.
#case@maru:~/temp:[0]$ echo test2>test;stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
Content modified. Modify and Change has changed.
#case@maru:~/temp:[0]$ cat test ; stat test
test2
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
File read. Access changed.
#case@maru:~/temp:[0]$ chmod 0000 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Changing perms. Change modified.
#case@maru:~/temp:[0]$ echo test3>test;stat test
bash: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed modification. No changes
#case@maru:~/temp:[0]$ cat test ; stat test
cat: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed reading. No changes.
#case@maru:~/temp:[0]$ chmod 0644 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:55:45.860198022 +0000
Birth: -
Restoring perms. Change modified.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503321%2fhow-to-get-the-last-modified-time-if-the-content-is-modified%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The command stat
gives you that information. You can see three timestamps. Access, Modify and Change. By (succesfuly) reading the file, Access is modified. By changing for example the permissions, Change is modified. If the content is changed, Modify is changed. Take a look at this:
#case@maru:~/temp:[0]$ rm test
#case@maru:~/temp:[0]$ echo test>test;stat test
File: test
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:39.715956782 +0000
Change: 2019-03-04 17:52:39.715956782 +0000
Birth: -
File created. All the timestamps are the same.
#case@maru:~/temp:[0]$ echo test2>test;stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
Content modified. Modify and Change has changed.
#case@maru:~/temp:[0]$ cat test ; stat test
test2
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
File read. Access changed.
#case@maru:~/temp:[0]$ chmod 0000 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Changing perms. Change modified.
#case@maru:~/temp:[0]$ echo test3>test;stat test
bash: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed modification. No changes
#case@maru:~/temp:[0]$ cat test ; stat test
cat: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed reading. No changes.
#case@maru:~/temp:[0]$ chmod 0644 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:55:45.860198022 +0000
Birth: -
Restoring perms. Change modified.
add a comment |
The command stat
gives you that information. You can see three timestamps. Access, Modify and Change. By (succesfuly) reading the file, Access is modified. By changing for example the permissions, Change is modified. If the content is changed, Modify is changed. Take a look at this:
#case@maru:~/temp:[0]$ rm test
#case@maru:~/temp:[0]$ echo test>test;stat test
File: test
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:39.715956782 +0000
Change: 2019-03-04 17:52:39.715956782 +0000
Birth: -
File created. All the timestamps are the same.
#case@maru:~/temp:[0]$ echo test2>test;stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
Content modified. Modify and Change has changed.
#case@maru:~/temp:[0]$ cat test ; stat test
test2
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
File read. Access changed.
#case@maru:~/temp:[0]$ chmod 0000 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Changing perms. Change modified.
#case@maru:~/temp:[0]$ echo test3>test;stat test
bash: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed modification. No changes
#case@maru:~/temp:[0]$ cat test ; stat test
cat: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed reading. No changes.
#case@maru:~/temp:[0]$ chmod 0644 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:55:45.860198022 +0000
Birth: -
Restoring perms. Change modified.
add a comment |
The command stat
gives you that information. You can see three timestamps. Access, Modify and Change. By (succesfuly) reading the file, Access is modified. By changing for example the permissions, Change is modified. If the content is changed, Modify is changed. Take a look at this:
#case@maru:~/temp:[0]$ rm test
#case@maru:~/temp:[0]$ echo test>test;stat test
File: test
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:39.715956782 +0000
Change: 2019-03-04 17:52:39.715956782 +0000
Birth: -
File created. All the timestamps are the same.
#case@maru:~/temp:[0]$ echo test2>test;stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
Content modified. Modify and Change has changed.
#case@maru:~/temp:[0]$ cat test ; stat test
test2
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
File read. Access changed.
#case@maru:~/temp:[0]$ chmod 0000 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Changing perms. Change modified.
#case@maru:~/temp:[0]$ echo test3>test;stat test
bash: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed modification. No changes
#case@maru:~/temp:[0]$ cat test ; stat test
cat: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed reading. No changes.
#case@maru:~/temp:[0]$ chmod 0644 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:55:45.860198022 +0000
Birth: -
Restoring perms. Change modified.
The command stat
gives you that information. You can see three timestamps. Access, Modify and Change. By (succesfuly) reading the file, Access is modified. By changing for example the permissions, Change is modified. If the content is changed, Modify is changed. Take a look at this:
#case@maru:~/temp:[0]$ rm test
#case@maru:~/temp:[0]$ echo test>test;stat test
File: test
Size: 5 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:39.715956782 +0000
Change: 2019-03-04 17:52:39.715956782 +0000
Birth: -
File created. All the timestamps are the same.
#case@maru:~/temp:[0]$ echo test2>test;stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:52:39.715956782 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
Content modified. Modify and Change has changed.
#case@maru:~/temp:[0]$ cat test ; stat test
test2
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:52:53.739979011 +0000
Birth: -
File read. Access changed.
#case@maru:~/temp:[0]$ chmod 0000 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Changing perms. Change modified.
#case@maru:~/temp:[0]$ echo test3>test;stat test
bash: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed modification. No changes
#case@maru:~/temp:[0]$ cat test ; stat test
cat: test: Permission denied
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0000/----------) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:54:13.792092496 +0000
Birth: -
Failed reading. No changes.
#case@maru:~/temp:[0]$ chmod 0644 test ; stat test
File: test
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: 806h/2054d Inode: 21627629 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ case) Gid: ( 1000/ case)
Access: 2019-03-04 17:53:11.676006377 +0000
Modify: 2019-03-04 17:52:53.739979011 +0000
Change: 2019-03-04 17:55:45.860198022 +0000
Birth: -
Restoring perms. Change modified.
answered Mar 4 at 18:05
JuanJuan
201110
201110
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503321%2fhow-to-get-the-last-modified-time-if-the-content-is-modified%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you give a minimal example for the claim "the last updated time of that file will change even after getting write error". For me (16.04, ext4), this is clearly not the case. Which file system?
– RoVo
Feb 27 at 12:22
@RoVo actually an editor that saves a R/O file can save a new copy, remove the R/O file (possible since the parent directory is R/W) and then rename the new copy (and set it R/O). But I agree that the OP should describe the use case more clearly (even though I have little hope that there is a solution to this).
– xenoid
Feb 27 at 12:32
But then it is a new file, and this does not happen after a write error.
– RoVo
Feb 27 at 12:33