![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Printing Year in ls -ltr command | ragugct | Shell Programming and Scripting | 9 | 07-11-2008 07:11 AM |
| Network Command for Listing Wireless networks | Octal | UNIX for Dummies Questions & Answers | 1 | 06-07-2007 06:44 PM |
| ls command for listing the number of files | jimmyc | UNIX for Dummies Questions & Answers | 4 | 03-23-2007 09:34 PM |
| Easy one : command listing total memory | beginer | HP-UX | 4 | 05-31-2006 05:22 AM |
| TAR command , listing backed up files | FredSmith | SUN Solaris | 3 | 10-03-2005 07:08 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
listing year in ls command
Hi all ..
As per rule i searched the forum i am not able found out ... I want to display the year in when listing the files .. when i use ls -lt it is not displaying files with recent 6 month old .. I know that perderabo has written a script for that if you give that link it will be usefull.. i want to display the file listing with year ... Else if the is a way please let me know .. Tried ls -lT there no option i my HP_UNIX for ls with T ... Thanks in advance Arun .. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Any one please let me know how to display year when doing LS.. please let me know how can that done by shell script .. or else is there is any option in ls .I did man ls as well but no result ...
|
|
#3
|
||||
|
||||
|
Please do not bump your posts.
And the behaviour of ls is such that the year is displayed only for files older than 6 months. If you want the year for files less than 6 months old, you will have to write a program either in C/perl/python that does the task. The basic system call that you will use is stat(2). You can check the man page for more details. In the structure that stat(2) returns, you will find st_mtime. This is the time in seconds since 00:00:00 UTC, Jan. 1, 1970 that the file was modified. You can pass that onto ctime(3) that will convert the time into a human readable format. |
|
#4
|
|||
|
|||
|
Thanks Blowtorch ..
I remeber that some where here is form i come across the script that will display the file with year .That was written by perderabo if so any one knows that please send me the link .... i tried to found out but i could not ... Blowtourch i will try that with c code mean whilw .. Thanks in advance.. Arun. |
|||
| Google The UNIX and Linux Forums |