Linux AIX ls command to get the date timestamp along with year of files along directory [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-2
down vote

favorite












ls command to return the date time stamp along with year for the files along the directory.Tried all possible options of ls command,it is either returning the date or date time without year or date with year but not date time(hh:mm) year.Kindly provide any inputs for ls command for above case on AIX server.



find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; 


this command gives me output like below without the year: Output:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt


And the other command:



find /dir/abc -name '*.txt' -mtime +180 -exec ls -e ;


to return the year. This gives me an output like below without the timestamp:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 2016 /dir/abc/compass.txt


I want my output to have both the timestamp and year which should be executable on AIX







share|improve this question














closed as unclear what you're asking by Basile Starynkevitch, Jeff Schaller, Kusalananda, Stephen Rauch, Satō Katsura Oct 15 '17 at 17:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    Linux and AIX are two different Unixes. On Linux, ls is generally from GNU coreutils which you could compile on AIX. Your question is unclear. You could also use the stat(1) command.
    – Basile Starynkevitch
    Oct 15 '17 at 14:17







  • 1




    Please edit your question to improve it. Give the exact commands that you have tried, and their output.
    – Basile Starynkevitch
    Oct 15 '17 at 14:19










  • stat does not work on AIX 7.1
    – surya amala Vungarala
    Oct 15 '17 at 14:35










  • find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; this command gives me output like below without the year: -rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt
    – surya amala Vungarala
    Oct 15 '17 at 14:40






  • 3




    Are you on Linux, AIX, or both?
    – Jeff Schaller
    Oct 15 '17 at 14:59














up vote
-2
down vote

favorite












ls command to return the date time stamp along with year for the files along the directory.Tried all possible options of ls command,it is either returning the date or date time without year or date with year but not date time(hh:mm) year.Kindly provide any inputs for ls command for above case on AIX server.



find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; 


this command gives me output like below without the year: Output:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt


And the other command:



find /dir/abc -name '*.txt' -mtime +180 -exec ls -e ;


to return the year. This gives me an output like below without the timestamp:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 2016 /dir/abc/compass.txt


I want my output to have both the timestamp and year which should be executable on AIX







share|improve this question














closed as unclear what you're asking by Basile Starynkevitch, Jeff Schaller, Kusalananda, Stephen Rauch, Satō Katsura Oct 15 '17 at 17:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    Linux and AIX are two different Unixes. On Linux, ls is generally from GNU coreutils which you could compile on AIX. Your question is unclear. You could also use the stat(1) command.
    – Basile Starynkevitch
    Oct 15 '17 at 14:17







  • 1




    Please edit your question to improve it. Give the exact commands that you have tried, and their output.
    – Basile Starynkevitch
    Oct 15 '17 at 14:19










  • stat does not work on AIX 7.1
    – surya amala Vungarala
    Oct 15 '17 at 14:35










  • find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; this command gives me output like below without the year: -rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt
    – surya amala Vungarala
    Oct 15 '17 at 14:40






  • 3




    Are you on Linux, AIX, or both?
    – Jeff Schaller
    Oct 15 '17 at 14:59












up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











ls command to return the date time stamp along with year for the files along the directory.Tried all possible options of ls command,it is either returning the date or date time without year or date with year but not date time(hh:mm) year.Kindly provide any inputs for ls command for above case on AIX server.



find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; 


this command gives me output like below without the year: Output:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt


And the other command:



find /dir/abc -name '*.txt' -mtime +180 -exec ls -e ;


to return the year. This gives me an output like below without the timestamp:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 2016 /dir/abc/compass.txt


I want my output to have both the timestamp and year which should be executable on AIX







share|improve this question














ls command to return the date time stamp along with year for the files along the directory.Tried all possible options of ls command,it is either returning the date or date time without year or date with year but not date time(hh:mm) year.Kindly provide any inputs for ls command for above case on AIX server.



find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; 


this command gives me output like below without the year: Output:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt


And the other command:



find /dir/abc -name '*.txt' -mtime +180 -exec ls -e ;


to return the year. This gives me an output like below without the timestamp:



-rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 2016 /dir/abc/compass.txt


I want my output to have both the timestamp and year which should be executable on AIX









share|improve this question













share|improve this question




share|improve this question








edited Oct 15 '17 at 15:35









Andy Dalton

4,7991520




4,7991520










asked Oct 15 '17 at 14:14









surya amala Vungarala

63




63




closed as unclear what you're asking by Basile Starynkevitch, Jeff Schaller, Kusalananda, Stephen Rauch, Satō Katsura Oct 15 '17 at 17:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Basile Starynkevitch, Jeff Schaller, Kusalananda, Stephen Rauch, Satō Katsura Oct 15 '17 at 17:37


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Linux and AIX are two different Unixes. On Linux, ls is generally from GNU coreutils which you could compile on AIX. Your question is unclear. You could also use the stat(1) command.
    – Basile Starynkevitch
    Oct 15 '17 at 14:17







  • 1




    Please edit your question to improve it. Give the exact commands that you have tried, and their output.
    – Basile Starynkevitch
    Oct 15 '17 at 14:19










  • stat does not work on AIX 7.1
    – surya amala Vungarala
    Oct 15 '17 at 14:35










  • find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; this command gives me output like below without the year: -rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt
    – surya amala Vungarala
    Oct 15 '17 at 14:40






  • 3




    Are you on Linux, AIX, or both?
    – Jeff Schaller
    Oct 15 '17 at 14:59












  • 1




    Linux and AIX are two different Unixes. On Linux, ls is generally from GNU coreutils which you could compile on AIX. Your question is unclear. You could also use the stat(1) command.
    – Basile Starynkevitch
    Oct 15 '17 at 14:17







  • 1




    Please edit your question to improve it. Give the exact commands that you have tried, and their output.
    – Basile Starynkevitch
    Oct 15 '17 at 14:19










  • stat does not work on AIX 7.1
    – surya amala Vungarala
    Oct 15 '17 at 14:35










  • find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; this command gives me output like below without the year: -rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt
    – surya amala Vungarala
    Oct 15 '17 at 14:40






  • 3




    Are you on Linux, AIX, or both?
    – Jeff Schaller
    Oct 15 '17 at 14:59







1




1




Linux and AIX are two different Unixes. On Linux, ls is generally from GNU coreutils which you could compile on AIX. Your question is unclear. You could also use the stat(1) command.
– Basile Starynkevitch
Oct 15 '17 at 14:17





Linux and AIX are two different Unixes. On Linux, ls is generally from GNU coreutils which you could compile on AIX. Your question is unclear. You could also use the stat(1) command.
– Basile Starynkevitch
Oct 15 '17 at 14:17





1




1




Please edit your question to improve it. Give the exact commands that you have tried, and their output.
– Basile Starynkevitch
Oct 15 '17 at 14:19




Please edit your question to improve it. Give the exact commands that you have tried, and their output.
– Basile Starynkevitch
Oct 15 '17 at 14:19












stat does not work on AIX 7.1
– surya amala Vungarala
Oct 15 '17 at 14:35




stat does not work on AIX 7.1
– surya amala Vungarala
Oct 15 '17 at 14:35












find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; this command gives me output like below without the year: -rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt
– surya amala Vungarala
Oct 15 '17 at 14:40




find /dir/abc -name '*.txt' -mtime +180 -exec ls -lu ; this command gives me output like below without the year: -rw-r--r-- 1 cdwgrp cdwgrp 16384 Oct 15 07:28 /dir/abc/compass.txt
– surya amala Vungarala
Oct 15 '17 at 14:40




3




3




Are you on Linux, AIX, or both?
– Jeff Schaller
Oct 15 '17 at 14:59




Are you on Linux, AIX, or both?
– Jeff Schaller
Oct 15 '17 at 14:59










3 Answers
3






active

oldest

votes

















up vote
1
down vote













Here's a hack that should work according to the aix tar man page. Use tar tv to list the timestamp.



$ tar cf - filea fileb | tar tvf -
-rw-r--r-- 114 1993-11-24 02:22 filea
-rw-r--r-- 6459 2016-04-19 21:43 fileb


I dont have an aix to test it on.






share|improve this answer



























    up vote
    1
    down vote













    Running this:



    #!/usr/bin/env bash

    echo
    rm -f f1 t2
    touch f1
    # [[[CC]YY]MMDDhhmm[.SS]]
    touch -t "201111041422.16" f2

    echo
    echo " With ls:"
    ls -l f?

    echo
    echo " With istat:"
    istat f2

    echo
    echo " With tar:"
    tar cf - f1 f2 | tar tvf -


    produces this:



    ./s2


    With ls:
    -rw-r--r-- 1 drl usr 0 Oct 15 19:28 f1
    -rw-r--r-- 1 drl usr 0 Nov 04 2011 f2

    With istat:
    Inode 1371635 on device 45/3 File
    Protection: rw-r--r--
    Owner: 1296(drl) Group: 100(usr)
    Link count: 1 Length 0 bytes

    Last updated: Sun Oct 15 19:28:03 DFT 2017
    Last modified: Fri Nov 4 14:22:16 DFT 2011
    Last accessed: Fri Nov 4 14:22:16 DFT 2011


    With tar:
    -rw-r--r-- 1296 100 0 Oct 15 19:28:03 2017 f1
    -rw-r--r-- 1296 100 0 Nov 04 14:22:16 2011 f2


    On a system like:



    aix 7.1.0.0
    bash GNU bash 4.2.10
    ls - ( /usr/bin/ls, Sep 05 2012 )
    istat - ( /usr/bin/istat, Aug 08 2010 )
    tar - ( /usr/bin/tar, Nov 27 2012 )


    Best wishes ... cheers, drl






    share|improve this answer





























      up vote
      0
      down vote













      On Linux, read ls(1) man page (or run man ls). Perhaps you want its --full-time option (of the GNU coreutils ls). For example on my Debian/Sid computer I can get:



      % ls --full-time bismon.h
      -rw-r--r-- 1 basileus basilegr 646 2017-08-25 06:35:27.960509752 +0200 bismon.h


      On AIX, read also the documentation (probably also the man page) of ls.



      BTW, the Linux ls command is often from the GNU coreutils which you could compile and install on AIX. Then you'll get the same ls on both Linux and AIX. With some precautions, you don't even need root access to do that, and I recommend you to do that.



      Consider also using date(1) using its -r option, e.g.



      find /dir/abc -name '*.txt' -mtime +180 
      -exec echo -n ; -exec date -r '+ %Y-%m-%d %H:%M:%S' ;


      Or, hoping that AIX is nearly POSIX compliant, restrict yourself to the options of POSIX ls.



      BTW, read also locale(7). You might setup some environment variables appropriately.



      Otherwise, compile some small C program on AIX (or write in some scripting language like Python, Perl, GNU awk, ...), which uses the readdir(3) and related functions with stat(2) system call and time related functions (localtime(3), strftime(3), etc...). You could even avoid the find by using nftw(3).



      PS. The simplest way is to compile and install GNU coreutils on AIX (or ask the sysadmin to do that), and you don't need root priviledges if you take some precautions.






      share|improve this answer






















      • It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
        – surya amala Vungarala
        Oct 15 '17 at 14:28











      • Did you compile and install GNU coreutils on AIX?
        – Basile Starynkevitch
        Oct 15 '17 at 14:43










      • I do not have access to this AIX server
        – surya amala Vungarala
        Oct 15 '17 at 14:49










      • Then how are you able to run ls on it? Again, edit much more your question to improve it.
        – Basile Starynkevitch
        Oct 15 '17 at 14:50











      • I cannot install anything on it since I am not the owner of it and it is a PROD server
        – surya amala Vungarala
        Oct 15 '17 at 14:53

















      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      Here's a hack that should work according to the aix tar man page. Use tar tv to list the timestamp.



      $ tar cf - filea fileb | tar tvf -
      -rw-r--r-- 114 1993-11-24 02:22 filea
      -rw-r--r-- 6459 2016-04-19 21:43 fileb


      I dont have an aix to test it on.






      share|improve this answer
























        up vote
        1
        down vote













        Here's a hack that should work according to the aix tar man page. Use tar tv to list the timestamp.



        $ tar cf - filea fileb | tar tvf -
        -rw-r--r-- 114 1993-11-24 02:22 filea
        -rw-r--r-- 6459 2016-04-19 21:43 fileb


        I dont have an aix to test it on.






        share|improve this answer






















          up vote
          1
          down vote










          up vote
          1
          down vote









          Here's a hack that should work according to the aix tar man page. Use tar tv to list the timestamp.



          $ tar cf - filea fileb | tar tvf -
          -rw-r--r-- 114 1993-11-24 02:22 filea
          -rw-r--r-- 6459 2016-04-19 21:43 fileb


          I dont have an aix to test it on.






          share|improve this answer












          Here's a hack that should work according to the aix tar man page. Use tar tv to list the timestamp.



          $ tar cf - filea fileb | tar tvf -
          -rw-r--r-- 114 1993-11-24 02:22 filea
          -rw-r--r-- 6459 2016-04-19 21:43 fileb


          I dont have an aix to test it on.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 15 '17 at 15:58









          meuh

          29.8k11751




          29.8k11751






















              up vote
              1
              down vote













              Running this:



              #!/usr/bin/env bash

              echo
              rm -f f1 t2
              touch f1
              # [[[CC]YY]MMDDhhmm[.SS]]
              touch -t "201111041422.16" f2

              echo
              echo " With ls:"
              ls -l f?

              echo
              echo " With istat:"
              istat f2

              echo
              echo " With tar:"
              tar cf - f1 f2 | tar tvf -


              produces this:



              ./s2


              With ls:
              -rw-r--r-- 1 drl usr 0 Oct 15 19:28 f1
              -rw-r--r-- 1 drl usr 0 Nov 04 2011 f2

              With istat:
              Inode 1371635 on device 45/3 File
              Protection: rw-r--r--
              Owner: 1296(drl) Group: 100(usr)
              Link count: 1 Length 0 bytes

              Last updated: Sun Oct 15 19:28:03 DFT 2017
              Last modified: Fri Nov 4 14:22:16 DFT 2011
              Last accessed: Fri Nov 4 14:22:16 DFT 2011


              With tar:
              -rw-r--r-- 1296 100 0 Oct 15 19:28:03 2017 f1
              -rw-r--r-- 1296 100 0 Nov 04 14:22:16 2011 f2


              On a system like:



              aix 7.1.0.0
              bash GNU bash 4.2.10
              ls - ( /usr/bin/ls, Sep 05 2012 )
              istat - ( /usr/bin/istat, Aug 08 2010 )
              tar - ( /usr/bin/tar, Nov 27 2012 )


              Best wishes ... cheers, drl






              share|improve this answer


























                up vote
                1
                down vote













                Running this:



                #!/usr/bin/env bash

                echo
                rm -f f1 t2
                touch f1
                # [[[CC]YY]MMDDhhmm[.SS]]
                touch -t "201111041422.16" f2

                echo
                echo " With ls:"
                ls -l f?

                echo
                echo " With istat:"
                istat f2

                echo
                echo " With tar:"
                tar cf - f1 f2 | tar tvf -


                produces this:



                ./s2


                With ls:
                -rw-r--r-- 1 drl usr 0 Oct 15 19:28 f1
                -rw-r--r-- 1 drl usr 0 Nov 04 2011 f2

                With istat:
                Inode 1371635 on device 45/3 File
                Protection: rw-r--r--
                Owner: 1296(drl) Group: 100(usr)
                Link count: 1 Length 0 bytes

                Last updated: Sun Oct 15 19:28:03 DFT 2017
                Last modified: Fri Nov 4 14:22:16 DFT 2011
                Last accessed: Fri Nov 4 14:22:16 DFT 2011


                With tar:
                -rw-r--r-- 1296 100 0 Oct 15 19:28:03 2017 f1
                -rw-r--r-- 1296 100 0 Nov 04 14:22:16 2011 f2


                On a system like:



                aix 7.1.0.0
                bash GNU bash 4.2.10
                ls - ( /usr/bin/ls, Sep 05 2012 )
                istat - ( /usr/bin/istat, Aug 08 2010 )
                tar - ( /usr/bin/tar, Nov 27 2012 )


                Best wishes ... cheers, drl






                share|improve this answer
























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Running this:



                  #!/usr/bin/env bash

                  echo
                  rm -f f1 t2
                  touch f1
                  # [[[CC]YY]MMDDhhmm[.SS]]
                  touch -t "201111041422.16" f2

                  echo
                  echo " With ls:"
                  ls -l f?

                  echo
                  echo " With istat:"
                  istat f2

                  echo
                  echo " With tar:"
                  tar cf - f1 f2 | tar tvf -


                  produces this:



                  ./s2


                  With ls:
                  -rw-r--r-- 1 drl usr 0 Oct 15 19:28 f1
                  -rw-r--r-- 1 drl usr 0 Nov 04 2011 f2

                  With istat:
                  Inode 1371635 on device 45/3 File
                  Protection: rw-r--r--
                  Owner: 1296(drl) Group: 100(usr)
                  Link count: 1 Length 0 bytes

                  Last updated: Sun Oct 15 19:28:03 DFT 2017
                  Last modified: Fri Nov 4 14:22:16 DFT 2011
                  Last accessed: Fri Nov 4 14:22:16 DFT 2011


                  With tar:
                  -rw-r--r-- 1296 100 0 Oct 15 19:28:03 2017 f1
                  -rw-r--r-- 1296 100 0 Nov 04 14:22:16 2011 f2


                  On a system like:



                  aix 7.1.0.0
                  bash GNU bash 4.2.10
                  ls - ( /usr/bin/ls, Sep 05 2012 )
                  istat - ( /usr/bin/istat, Aug 08 2010 )
                  tar - ( /usr/bin/tar, Nov 27 2012 )


                  Best wishes ... cheers, drl






                  share|improve this answer














                  Running this:



                  #!/usr/bin/env bash

                  echo
                  rm -f f1 t2
                  touch f1
                  # [[[CC]YY]MMDDhhmm[.SS]]
                  touch -t "201111041422.16" f2

                  echo
                  echo " With ls:"
                  ls -l f?

                  echo
                  echo " With istat:"
                  istat f2

                  echo
                  echo " With tar:"
                  tar cf - f1 f2 | tar tvf -


                  produces this:



                  ./s2


                  With ls:
                  -rw-r--r-- 1 drl usr 0 Oct 15 19:28 f1
                  -rw-r--r-- 1 drl usr 0 Nov 04 2011 f2

                  With istat:
                  Inode 1371635 on device 45/3 File
                  Protection: rw-r--r--
                  Owner: 1296(drl) Group: 100(usr)
                  Link count: 1 Length 0 bytes

                  Last updated: Sun Oct 15 19:28:03 DFT 2017
                  Last modified: Fri Nov 4 14:22:16 DFT 2011
                  Last accessed: Fri Nov 4 14:22:16 DFT 2011


                  With tar:
                  -rw-r--r-- 1296 100 0 Oct 15 19:28:03 2017 f1
                  -rw-r--r-- 1296 100 0 Nov 04 14:22:16 2011 f2


                  On a system like:



                  aix 7.1.0.0
                  bash GNU bash 4.2.10
                  ls - ( /usr/bin/ls, Sep 05 2012 )
                  istat - ( /usr/bin/istat, Aug 08 2010 )
                  tar - ( /usr/bin/tar, Nov 27 2012 )


                  Best wishes ... cheers, drl







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 15 '17 at 17:31

























                  answered Oct 15 '17 at 17:05









                  drl

                  45225




                  45225




















                      up vote
                      0
                      down vote













                      On Linux, read ls(1) man page (or run man ls). Perhaps you want its --full-time option (of the GNU coreutils ls). For example on my Debian/Sid computer I can get:



                      % ls --full-time bismon.h
                      -rw-r--r-- 1 basileus basilegr 646 2017-08-25 06:35:27.960509752 +0200 bismon.h


                      On AIX, read also the documentation (probably also the man page) of ls.



                      BTW, the Linux ls command is often from the GNU coreutils which you could compile and install on AIX. Then you'll get the same ls on both Linux and AIX. With some precautions, you don't even need root access to do that, and I recommend you to do that.



                      Consider also using date(1) using its -r option, e.g.



                      find /dir/abc -name '*.txt' -mtime +180 
                      -exec echo -n ; -exec date -r '+ %Y-%m-%d %H:%M:%S' ;


                      Or, hoping that AIX is nearly POSIX compliant, restrict yourself to the options of POSIX ls.



                      BTW, read also locale(7). You might setup some environment variables appropriately.



                      Otherwise, compile some small C program on AIX (or write in some scripting language like Python, Perl, GNU awk, ...), which uses the readdir(3) and related functions with stat(2) system call and time related functions (localtime(3), strftime(3), etc...). You could even avoid the find by using nftw(3).



                      PS. The simplest way is to compile and install GNU coreutils on AIX (or ask the sysadmin to do that), and you don't need root priviledges if you take some precautions.






                      share|improve this answer






















                      • It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
                        – surya amala Vungarala
                        Oct 15 '17 at 14:28











                      • Did you compile and install GNU coreutils on AIX?
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:43










                      • I do not have access to this AIX server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:49










                      • Then how are you able to run ls on it? Again, edit much more your question to improve it.
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:50











                      • I cannot install anything on it since I am not the owner of it and it is a PROD server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:53














                      up vote
                      0
                      down vote













                      On Linux, read ls(1) man page (or run man ls). Perhaps you want its --full-time option (of the GNU coreutils ls). For example on my Debian/Sid computer I can get:



                      % ls --full-time bismon.h
                      -rw-r--r-- 1 basileus basilegr 646 2017-08-25 06:35:27.960509752 +0200 bismon.h


                      On AIX, read also the documentation (probably also the man page) of ls.



                      BTW, the Linux ls command is often from the GNU coreutils which you could compile and install on AIX. Then you'll get the same ls on both Linux and AIX. With some precautions, you don't even need root access to do that, and I recommend you to do that.



                      Consider also using date(1) using its -r option, e.g.



                      find /dir/abc -name '*.txt' -mtime +180 
                      -exec echo -n ; -exec date -r '+ %Y-%m-%d %H:%M:%S' ;


                      Or, hoping that AIX is nearly POSIX compliant, restrict yourself to the options of POSIX ls.



                      BTW, read also locale(7). You might setup some environment variables appropriately.



                      Otherwise, compile some small C program on AIX (or write in some scripting language like Python, Perl, GNU awk, ...), which uses the readdir(3) and related functions with stat(2) system call and time related functions (localtime(3), strftime(3), etc...). You could even avoid the find by using nftw(3).



                      PS. The simplest way is to compile and install GNU coreutils on AIX (or ask the sysadmin to do that), and you don't need root priviledges if you take some precautions.






                      share|improve this answer






















                      • It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
                        – surya amala Vungarala
                        Oct 15 '17 at 14:28











                      • Did you compile and install GNU coreutils on AIX?
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:43










                      • I do not have access to this AIX server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:49










                      • Then how are you able to run ls on it? Again, edit much more your question to improve it.
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:50











                      • I cannot install anything on it since I am not the owner of it and it is a PROD server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:53












                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      On Linux, read ls(1) man page (or run man ls). Perhaps you want its --full-time option (of the GNU coreutils ls). For example on my Debian/Sid computer I can get:



                      % ls --full-time bismon.h
                      -rw-r--r-- 1 basileus basilegr 646 2017-08-25 06:35:27.960509752 +0200 bismon.h


                      On AIX, read also the documentation (probably also the man page) of ls.



                      BTW, the Linux ls command is often from the GNU coreutils which you could compile and install on AIX. Then you'll get the same ls on both Linux and AIX. With some precautions, you don't even need root access to do that, and I recommend you to do that.



                      Consider also using date(1) using its -r option, e.g.



                      find /dir/abc -name '*.txt' -mtime +180 
                      -exec echo -n ; -exec date -r '+ %Y-%m-%d %H:%M:%S' ;


                      Or, hoping that AIX is nearly POSIX compliant, restrict yourself to the options of POSIX ls.



                      BTW, read also locale(7). You might setup some environment variables appropriately.



                      Otherwise, compile some small C program on AIX (or write in some scripting language like Python, Perl, GNU awk, ...), which uses the readdir(3) and related functions with stat(2) system call and time related functions (localtime(3), strftime(3), etc...). You could even avoid the find by using nftw(3).



                      PS. The simplest way is to compile and install GNU coreutils on AIX (or ask the sysadmin to do that), and you don't need root priviledges if you take some precautions.






                      share|improve this answer














                      On Linux, read ls(1) man page (or run man ls). Perhaps you want its --full-time option (of the GNU coreutils ls). For example on my Debian/Sid computer I can get:



                      % ls --full-time bismon.h
                      -rw-r--r-- 1 basileus basilegr 646 2017-08-25 06:35:27.960509752 +0200 bismon.h


                      On AIX, read also the documentation (probably also the man page) of ls.



                      BTW, the Linux ls command is often from the GNU coreutils which you could compile and install on AIX. Then you'll get the same ls on both Linux and AIX. With some precautions, you don't even need root access to do that, and I recommend you to do that.



                      Consider also using date(1) using its -r option, e.g.



                      find /dir/abc -name '*.txt' -mtime +180 
                      -exec echo -n ; -exec date -r '+ %Y-%m-%d %H:%M:%S' ;


                      Or, hoping that AIX is nearly POSIX compliant, restrict yourself to the options of POSIX ls.



                      BTW, read also locale(7). You might setup some environment variables appropriately.



                      Otherwise, compile some small C program on AIX (or write in some scripting language like Python, Perl, GNU awk, ...), which uses the readdir(3) and related functions with stat(2) system call and time related functions (localtime(3), strftime(3), etc...). You could even avoid the find by using nftw(3).



                      PS. The simplest way is to compile and install GNU coreutils on AIX (or ask the sysadmin to do that), and you don't need root priviledges if you take some precautions.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Oct 15 '17 at 15:16

























                      answered Oct 15 '17 at 14:23









                      Basile Starynkevitch

                      7,9231940




                      7,9231940











                      • It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
                        – surya amala Vungarala
                        Oct 15 '17 at 14:28











                      • Did you compile and install GNU coreutils on AIX?
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:43










                      • I do not have access to this AIX server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:49










                      • Then how are you able to run ls on it? Again, edit much more your question to improve it.
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:50











                      • I cannot install anything on it since I am not the owner of it and it is a PROD server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:53
















                      • It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
                        – surya amala Vungarala
                        Oct 15 '17 at 14:28











                      • Did you compile and install GNU coreutils on AIX?
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:43










                      • I do not have access to this AIX server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:49










                      • Then how are you able to run ls on it? Again, edit much more your question to improve it.
                        – Basile Starynkevitch
                        Oct 15 '17 at 14:50











                      • I cannot install anything on it since I am not the owner of it and it is a PROD server
                        – surya amala Vungarala
                        Oct 15 '17 at 14:53















                      It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
                      – surya amala Vungarala
                      Oct 15 '17 at 14:28





                      It doesnot work with --fulltime: Say my command is something like: It gives me an error saying(not recognized flag): find /dir/abc -name '*.txt' -mtime +180 -exec ls --full-time ;
                      – surya amala Vungarala
                      Oct 15 '17 at 14:28













                      Did you compile and install GNU coreutils on AIX?
                      – Basile Starynkevitch
                      Oct 15 '17 at 14:43




                      Did you compile and install GNU coreutils on AIX?
                      – Basile Starynkevitch
                      Oct 15 '17 at 14:43












                      I do not have access to this AIX server
                      – surya amala Vungarala
                      Oct 15 '17 at 14:49




                      I do not have access to this AIX server
                      – surya amala Vungarala
                      Oct 15 '17 at 14:49












                      Then how are you able to run ls on it? Again, edit much more your question to improve it.
                      – Basile Starynkevitch
                      Oct 15 '17 at 14:50





                      Then how are you able to run ls on it? Again, edit much more your question to improve it.
                      – Basile Starynkevitch
                      Oct 15 '17 at 14:50













                      I cannot install anything on it since I am not the owner of it and it is a PROD server
                      – surya amala Vungarala
                      Oct 15 '17 at 14:53




                      I cannot install anything on it since I am not the owner of it and it is a PROD server
                      – surya amala Vungarala
                      Oct 15 '17 at 14:53


                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay