LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2011, 08:41 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,625

Rep: Reputation: 51
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.
 
Old 06-22-2011, 09:04 PM   #2
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 515

Rep: Reputation: 224Reputation: 224Reputation: 224
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
 
Old 06-22-2011, 10:30 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,625

Original Poster
Rep: Reputation: 51
This brings about another question. What is ctime? It says "time of last modification of file status information", which I do not understand.
 
Old 06-22-2011, 11:00 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,552

Rep: Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899
have a look at:
Code:
man 2 stat
And search for st_ctime
 
Old 06-22-2011, 11:13 PM   #5
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 515

Rep: Reputation: 224Reputation: 224Reputation: 224
Quote:
Originally Posted by stf92 View Post
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
 
Old 06-22-2011, 11:26 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,625

Original Poster
Rep: Reputation: 51
Awesome. I was changing ctime all the time without really modifying the file itself when I did chmod or chown! Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace word in file-mulitple times. AlanL Linux - Software 5 06-25-2007 03:14 AM
Writing several times to a file with Java megabot Programming 3 04-12-2006 01:35 PM
System hangs; Atheros Madwifi-ping times out every 15/16 times james 456 Linux - Networking 0 01-12-2006 07:55 PM
displaying file access times in console k4zau Linux - Software 4 10-26-2003 11:48 PM
Ping - Logging the times to a file. johnsont Programming 2 09-09-2003 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration