- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to find ctime, mtime, etc. of files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:25 AM
тАО06-03-2003 06:25 AM
Is there as ls mode, or other utility, that can show me the atime and ctime of a file (the same one used by the find command?)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:31 AM
тАО06-03-2003 06:31 AM
Re: How to find ctime, mtime, etc. of files
mtime -> ls -t
atime -> ls -u
ctime -> ls -c
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:32 AM
тАО06-03-2003 06:32 AM
Re: How to find ctime, mtime, etc. of files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:33 AM
тАО06-03-2003 06:33 AM
Re: How to find ctime, mtime, etc. of files
Remember that 'find's 'mtime', 'atime' and 'ctime' are based on a 24-hour clock. That is, specifying '-ctime +1' assumes *exactly* 24-hours. If you need to fidn files with greater precision, touch a reference file and use the '-newer' option. For example:
# touch -amt 06030001 /tmp/ref
# find /tmp -newerc /tmp/ref
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:37 AM
тАО06-03-2003 06:37 AM
Re: How to find ctime, mtime, etc. of files
find . -ctime +X
It's not finding a lot of files I think it should, and the ctime seems like the culprit. I want to see the actual ctimes of some of these files so I can determine what the problem is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:37 AM
тАО06-03-2003 06:37 AM
Re: How to find ctime, mtime, etc. of files
Also, don't confuse the 'ctime' and 'mtime' attributes. The 'ctime' represents the timestamp of the last inode change (permissions, ownership, etc.). The 'mtime' is the last modification time. There is no creation time. 'atime', of course, is the last access timestamp. Utilities like 'fbackup' will change the 'ctime' since they copy a file and then reset the lastaccess timestamp ('atime') to what it was before the copy began.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:38 AM
тАО06-03-2003 06:38 AM
Re: How to find ctime, mtime, etc. of files
files will be having last modified date and time (ls -l), but you can't see the creation time. whereas if u have tool to operate inode which will contain creation/modified time you can
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:41 AM
тАО06-03-2003 06:41 AM
Re: How to find ctime, mtime, etc. of files
perl -e '@a=stat("/path/to/file"); print $a[8];'
will return atime in seconds;
perl -e '@a=stat("/path/to/file"); print $a[8];'
will return ctime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:42 AM
тАО06-03-2003 06:42 AM
Re: How to find ctime, mtime, etc. of files
JRF's reply is probably what you need, but again it is not going to show you those times.
The only way I know to show you those times is to obtain the file's inode #
ls -i
Then go into fsdb, go to that inode & query
at -> access time
mt -> mod time
ct -> inode change time
Problem here is I don't think this can be done from the command prompt. You have to go into fsdb & do this interactiely. And I would *strongly* caution you to be VERY careful with fsdb - it's one of THE most destructive commands out there.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:49 AM
тАО06-03-2003 06:49 AM
Re: How to find ctime, mtime, etc. of files
Jeff, sorry I should have given you more points!
So, ctime is out ... guess I'll use mtime instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:50 AM
тАО06-03-2003 06:50 AM
Re: How to find ctime, mtime, etc. of files
As Jeff indicated, 'ls' will allow you to see the modification timestamp ('mtime'); the last access timestamp ('atime') or the 'change' ('ctime') timestamp. See the man pages for 'ls'. For modifiction, lastaccess and inode changed, respectively, do
# ls -l filename
# ls -ul filename
# ls -cl filename
A useful additional flag to 'ls' is '-r' to reverse the sort order.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 06:54 AM
тАО06-03-2003 06:54 AM
Re: How to find ctime, mtime, etc. of files
reading man fstat - which is defined there as
"last file status change time".to test one
can write simple c code,sth like open() on file
and fstat() on its file descriptor.theoretical
though...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2003 07:39 AM
тАО06-03-2003 07:39 AM
Re: How to find ctime, mtime, etc. of files
#!/opt/perl/bin/perl
$filename = "$ARGV[0]";
#($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blocksize, $blocks) = stat($filename);
@s = stat($filename);
$atime = localtime($s[8]);
$mtime = localtime($s[9]);
$ctime = localtime($s[10);
print "Time of the last access (atime) = $atime\n";
print "Time of last inode change (ctime) = $ctime\n";
print "Time of the last modification (mtime) = $mtime\n";
exit;