LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ls and the several times associated with a file. (https://www.linuxquestions.org/questions/linux-newbie-8/ls-and-the-several-times-associated-with-a-file-887832/)

stf92 06-22-2011 07:41 PM

ls and the several times associated with a file.
 
Hi:

ls in its man page mentions several times, e.g., ctime. What are the times ls has something to do with? Thanks.

Diantre 06-22-2011 08:04 PM

Files in Unix have three time fields: change time, access time and modify time. You can pass parameters to ls to sort the file list based on one of the time fields.

From the ls manpage:

Code:

      -c    with  -lt:  sort by, and show, ctime (time of last modification of file
              status information) with -l: show ctime and  sort  by  name  otherwise:
              sort by ctime

Code:

      -t    sort by modification time
Code:

      -u    with  -lt: sort by, and show, access time with -l: show access time and
              sort by name otherwise: sort by access time


stf92 06-22-2011 09:30 PM

This brings about another question. What is ctime? It says "time of last modification of file status information", which I do not understand.

grail 06-22-2011 10:00 PM

have a look at:
Code:

man 2 stat
And search for st_ctime

Diantre 06-22-2011 10:13 PM

Quote:

Originally Posted by stf92 (Post 4393332)
This brings about another question. What is ctime? It says "time of last modification of file status information", which I do not understand.

Check out this page: http://www.unix.com/tips-tutorials/2...ime-atime.html

stf92 06-22-2011 10:26 PM

Awesome. I was changing ctime all the time without really modifying the file itself when I did chmod or chown! Thanks.


All times are GMT -5. The time now is 05:42 AM.