Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2003
    Posts
    3

    Unanswered: how to get file modification time and date(including year) in solaris?

    How can I get the last modification time and date (mmm/dd/year) of a file in Solaris.

    In Linux you can find out the full time and date of a file by typing
    ls --full-time command.

    How can I get the same info in Solaris?

    Thanks!!!!!!!!

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780

    Re: how to get file modification time and date(including year) in solaris?

    Originally posted by msr20
    How can I get the last modification time and date (mmm/dd/year) of a file in Solaris.

    In Linux you can find out the full time and date of a file by typing
    ls --full-time command.

    How can I get the same info in Solaris?

    Thanks!!!!!!!!
    Hi,

    Please check with "ls -lu".

    Gustavo.

  3. #3
    Join Date
    Nov 2003
    Posts
    3
    In linux, If you type "ls --full-time", it includes the year in the file last modification time. If you type "ls -l" , it won't not display the year for recent files. Example of "ls --full-time" :

    drwx------ 2 msr20 students 4096 Wed Nov 19 23:14:04 2003 file1

    drwx------ 2 msr20 students 4096 Thu Nov 20 23:30:31 2003 file2

    But in Solaris, "ls --full-time" switch option is not available. I tried
    "ls -lu" , it still does not dispaly the year. By the way -u option is used to get the use time of last access instead of last modification time of a file.

    In above example , if you type " ls -l" instead of using the "--full-time" option, the year will not be displayed. I need the year.
    drwx------ 2 msr20 students 4096 Nov 19 23:14 test
    drwx------ 2 msr20 students 4096 Nov 20 23:30 test2

    Is there a way to get the last modification of a file that includes the year along with month, day, and time in Solaris?

    Thanks!!!!!!!!

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780
    Originally posted by msr20
    In linux, If you type "ls --full-time", it includes the year in the file last modification time. If you type "ls -l" , it won't not display the year for recent files. Example of "ls --full-time" :

    drwx------ 2 msr20 students 4096 Wed Nov 19 23:14:04 2003 file1

    drwx------ 2 msr20 students 4096 Thu Nov 20 23:30:31 2003 file2

    But in Solaris, "ls --full-time" switch option is not available. I tried
    "ls -lu" , it still does not dispaly the year. By the way -u option is used to get the use time of last access instead of last modification time of a file.

    In above example , if you type " ls -l" instead of using the "--full-time" option, the year will not be displayed. I need the year.
    drwx------ 2 msr20 students 4096 Nov 19 23:14 test
    drwx------ 2 msr20 students 4096 Nov 20 23:30 test2

    Is there a way to get the last modification of a file that includes the year along with month, day, and time in Solaris?

    Thanks!!!!!!!!
    Hi,

    I think that, in Unix, all files and directory that be into calendar year not show the year.

    Gustavo.

  5. #5
    Join Date
    Sep 2003
    Posts
    71
    if files are less than sixmonths old then calendar year is not displayed using ll command., otherwise yr shows ( atleast on HP-UX )

  6. #6
    Join Date
    Nov 2003
    Posts
    3
    Thanks for your response. I used Perl script to get the last modification time of a file. I guess, it is not possible using shell script. I used the stat function to solve my problem. If you type man stat, it shows you how you can get this information.

    Thanks!

  7. #7
    Join Date
    Apr 2014
    Posts
    1
    ls -E is the answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •