ls command

In UNIX
  it says  ls -c command list files by inode modification time. I know inode will be created only when file is created. So does this mean that this command would list the files in the order they are created ? What is the default order in which it would display the file the regular ls command ?

Thanks
Koppcha
LVL 8
koppchaAsked:
Who is Participating?
 
ozoCommented:
    The time-related fields of struct stat are as follows:

     st_atime     Time when file data last accessed.  Changed by the mknod(2),
                  utimes(2) and read(2) system calls.

     st_mtime     Time when file data last modified.  Changed by the mknod(2),
                  utimes(2) and write(2) system calls.

     st_ctime     Time when file status was last changed (inode data modifica-
                  tion).  Changed by the chmod(2), chown(2), link(2),
                  mknod(2), rename(2), unlink(2), utimes(2) and write(2) sys-
                  tem calls.
0
 
arthurjbCommented:
The regular ls command lists the files in alphabetical order.

I normally use ls -lat which gives the output in order of time.
0
 
TintinCommented:
As the file creation time is not stored in Unix, there's no way you can easily tell for sure.

inodes change if you chmod a file for example, so that would effect the sort order of 'ls -c'
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
root_startCommented:
Hi koppcha,

There is one way to order the files by they last update date and time and you can do this with the following command: "ls -lrt" or you can use the following to do this by creation time: ls -lrc

I hope it helps.
0
 
TintinCommented:
root_start.

Please read previous comments explaining why Unix has no creation time.
0
 
root_startCommented:
So, koppcha can use: "ls -lrt" that lists from last update time. =0)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.