Sponsored Content
Full Discussion: File used
Operating Systems HP-UX File used Post 303016475 by rbatte1 on Friday 27th of April 2018 12:01:16 PM
Old 04-27-2018
When you say used, how do you mean? The file information records three timestamps. Access, change & modification. The command stat and various flags can be used to display any or all of these and the manual page describes what each one is for. It might seem odd, but a change and a modification are not the same.

The flags are as follows:-
Quote:
man stat|grep Time
%x Time of last access
%X Time of last access as seconds since Epoch
%y Time of last modification
%Y Time of last modification as seconds since Epoch
%z Time of last change
%Z Time of last change as seconds since Epoch
I think:-
  • the modification refers to what you normally see as the file's timestamp with something like ls -l $filename
  • the access time is the last read or write operation on the content of the file (but this includes backups
  • the change refers to any operation that updates the inode of the file. This can be a chmod, and update of the content (because the modified time changes)

Does that help?

What format do you need the output as? Sometimes the time since the Epoch (1/1/1970 00:00:00) can be useful to do calculations with.

If you just need to find files older / newer than a known time, perhaps you could use touch with a timestamp to create a reference file and then the -newer /tmp/ref_file or ! -newer /tmp/ref_file construction of a find command.



Do either of these approaches help?
Robin
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
touch(1)						      General Commands Manual							  touch(1)

NAME
touch - update access, modification, and/or change times of file SYNOPSIS
ref_file time] file_name... Obsolescent time_str file_name... DESCRIPTION
updates the access, modification, and last-change times of each argument. The file name is created if it does not exist. If no time is specified (see date(1)) the current time is used. The and options are mutually exclusive. Options The following options are available: Change the access time of file_name to time, or to the current time if time is not specified. Do not change the modification time unless is also specified. Change the modification time of file_name to time, or to the current time if time is not specified. Do not change the access time unless is also specified. Silently prevent from creating the file if it did not previously exist. Do not write any diagnostic messages concerning this condi- tion. Use the corresponding time of ref_file instead of the current time. Use the specified time instead of the current time. The option argument is a decimal number of the form: [[CC]YY]MMDDhhmm[.SS] where each two digits represents the following: CC The first two digits of the year. YY The second two digits of the year. MM The month of the year (01-12). DD The day of the month (01-31). hh The hour of the day (00-23). mm The minute of the hour (00-59). SS The second of the minute (00-61). If neither CC nor YY is given, the current year is assumed. If YY is specified, but CC is not, CC is derived as fol- lows: (taken into account the local time factor) If YY is: CC becomes: ------------------------ 69-99 19 00-68 20 If the resulting time value precedes the Epoch (00:00:00 January 1, 1970 Greenwich Mean Time), exits immediately with an error status. The range for SS is 00 through 61 rather than 00 through 59 to accommodate leap seconds. If SS is 60 or 61, and the resulting time, as affected by the environment variable, does not refer to a leap second, the resulting time is one second after a time where SS is 59. If SS is not given a value, it is assumed to be 0. The syntax shown by the second line is recognized when neither the option, the option, nor the option delimiter is specified, and the first operand consists of all decimal digits. This operand is interpreted as the time argument instead of as a file name. However, in this case, time_str is assumed to be of the form: MMDDhhmm[YY] This is for backward compatibility. The form given above is recommended for future portability. The option delimiter can be used before the first file_name if there is a possibility that file_name consists of all digits, in order to ensure that the first syntax is used. succeeds when invoked by the of the file if any of the following are true: o A time is specified. o Only the access time of the file is being updated. o Only the modification time of the file is being updated. In addition, succeeds when invoked by a user with write permission on the file if of the following are true: o No time is specified. o the access time and modification time of the file are being updated. EXTERNAL INFLUENCES
Environment Variables If the time is specified via the option, is used to interpret the time for the specified time zone. determines the language in which messages are displayed. If is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty vari- able. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multibyte character code sets are supported. RETURN VALUE
returns the following values: All file_name arguments were successfully changed. Prints out a diagnostic message if an invalid time or a time earlier than the Epoch was specified with the option, or if the and options were both specified, or if one or more of the file_name arguments could not be accessed. EXAMPLES
The following command sets the modification and access times of the file named "bastille" to midnight, July 14, 1989, creating the file if it does not already exist. The following command does the same thing using the backward-compatible syntax: The following command sets the time of the two files named "0714000089" and "bastille" to the current time, creating them if they do not exist: To create a zero-length file, use any of the following: DEPENDENCIES
NFS An attempt to touch a file owned by the superuser on a remote server can fail, even if the invoking user has write permission on the file. SEE ALSO
date(1), utime(2). STANDARDS CONFORMANCE
touch(1)
All times are GMT -4. The time now is 04:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy