[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Don't understand Unix timestamps



On Thu, Sep 13, 2001 at 02:43:02AM +0100, Chris Kenrick wrote:
> Hi all,
> 
> I'm a bit confused about Unix timestamps on files.  In
> particular, I want to know what the timestamp on an
> 'ls -l' or a 'find . -ls' means.
> 

You can usually get this kind of information from man pages or info docs. 
For ls the info system gives the most complete information.  See the
following excerpts.

$ info ls

	-l
	--format=verbose
	In addition to the name of each file, print the file type,
	permissions, ..., and timestamp (by default, the modification
	time).  For files with a time more than six months old or more
	than one hour into the future, the timestamp contains the year
	instead of the time of day...

You can also list the access or status change times.  From the same source:

	-c
	--time=ctime
	--time=status
	--time=use
	If the long listing format (e.g., `-l', `-o') is being used, 
	print the status change time (the `ctime' in the inode) instead
	of the modification time...

	-u
	--time=atime
	--time=access
	if the long listing format (e.g., `--format=long') is being
	used, print the last access time (the `atime' in the inode)...



> On a different but related note, what is the easiest
> combination of commands to find
> 
> A) A list of files in a given directory that have been
> accessed in the last 24 hours

Try 'man find' or 'info find'.

$ find <given directory> -atime -24

> 
> B) The total disk usage by the given file list A)

The command you want is 'du' (disk usage, see 'man du' or 'info du').

$ du -sh `find <given directory> -atime -24`

Notice the back ticks (left single quotation mark) that surround the second
command.  This sends the output from the back ticked command line to the
preceding command, from the `find' command to the `du' command in this
instance.  'find <given directory> -atime -24 | xargs du -sh' should give
the same result.

HTH,

Gerald



Reply to: