How to arrange the files according to time


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to arrange the files according to time
# 1  
Old 05-22-2010
Error How to arrange the files according to time

hi friends, m new to unix environment..
i want to know that
"how could we arrange the various files in our unix system according to time at which they are accessed, and are there are ways that we can arrange them in ascending or descending manner..."

please help me out with full details...

its urgent..!!
# 2  
Old 05-22-2010
Code:
ls -ltu

and
Code:
ls -ltur

# 3  
Old 05-22-2010
Actually, -t and -u are mutually exclusive...but I think the OP will figure point is that it's available.
# 4  
Old 05-22-2010
What's wrong with my approach? Did you try it? It worked pretty nice for me and brought correct results.
Can you improve it?
Sorry if I got you wrong, but it sounds like I did a mistake...
# 5  
Old 05-22-2010
ls uses three different options to poll the file for access (atime), change (ctime) and modification (mtime) time attributes. Meanwhile, the -r flag/option will reverse the order of things.

hence...
Code:
$ ls -lt  file* 2>&1
-rw-rw-r--  1 curleb   sys        76392 May 11 16:07 file.csv
lrwxrwxrwx  1 curleb   sys            8 May 15 18:12 file.lnk -> file.csv
-rw-rw-r--  1 curleb   sys       554352 May 11 15:57 file.cpy

$ ls -lu  file* 2>&1
-rw-rw-r--  1 curleb   sys       554352 May 11 15:54 file.cpy
-rw-rw-r--  1 curleb   sys        76392 May 11 15:54 file.csv
lrwxrwxrwx  1 curleb   sys            8 May 15 18:12 file.lnk -> file.csv

$ ls -lc  file* 2>&1
-rw-rw-r--  1 curleb   sys       554352 May 11 16:05 file.cpy
-rw-rw-r--  1 curleb   sys        76392 May 11 16:07 file.csv
lrwxrwxrwx  1 curleb   sys            8 May 15 18:12 file.lnk -> file.csv

$ ls -ltr file* 2>&1
-rw-rw-r--  1 curleb   sys       554352 May 11 15:57 file.cpy
-rw-rw-r--  1 curleb   sys        76392 May 11 16:07 file.csv
lrwxrwxrwx  1 curleb   sys            8 May 15 18:12 file.lnk -> file.csv

$ ls -lur file* 2>&1
lrwxrwxrwx  1 curleb   sys            8 May 15 18:12 file.lnk -> file.csv
-rw-rw-r--  1 curleb   sys        76392 May 11 15:54 file.csv
-rw-rw-r--  1 curleb   sys       554352 May 11 15:54 file.cpy

$ ls -lcr file* 2>&1
lrwxrwxrwx  1 curleb   sys            8 May 15 18:12 file.lnk -> file.csv
-rw-rw-r--  1 curleb   sys        76392 May 11 16:07 file.csv
-rw-rw-r--  1 curleb   sys       554352 May 11 16:05 file.cpy

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sorting when i need to re-arrange

I have a directory with files of the form <name>_rpt_DDMMYY_HH24:00.html I need to list them by YYMMDD and I need to get the full name back. (1 Reply)
Discussion started by: guessingo
1 Replies

2. Shell Programming and Scripting

arrange files into columns

Hi may i ask how to arrange this file in into columns like example below Problem: #cat data.txt 1 2 3 4 5 a b c d 9 8 7 6 desired output (9 Replies)
Discussion started by: jao_madn
9 Replies

3. Shell Programming and Scripting

Re-arrange column

10.142.7.155 - - www.abc.com 404 - I have many columns which is tab delimited file, I have to re-arrange this to a particular column and also add "-" to 3rd column and 6th column. 10.142.7.155 - - - www.abc.com - 404 - (4 Replies)
Discussion started by: sandy1028
4 Replies

4. Shell Programming and Scripting

Arrange log files with AWK

Hello friends, I have too many log files to arrange. I use a simple script to create log files with below format and i forgot to create daily directory for them at the beginning. Because of this i should move all daily logs into a directory that i need to create. a part of "ls -l" output:... (1 Reply)
Discussion started by: EAGL€
1 Replies

5. Shell Programming and Scripting

Shell script to arrange files into several folders

Hello this is the script Im working on I have a picture collection that I rescued from a hard drive and there are thousands of pictures saved in one folder. What I need is to create several folders and put lets say around 200 pictures in each folder. At the end instead of having one huge... (8 Replies)
Discussion started by: kizofilax
8 Replies

6. UNIX for Dummies Questions & Answers

Arrange data

I have a following data: 100 200 300 400 I want the data to be arranged: 100 200 300 400 What is the best way to do this? Thanks! (5 Replies)
Discussion started by: bobo
5 Replies

7. Shell Programming and Scripting

Moving files which are generating time to time

Hi all, I always getting great response from this forum, that why i am putting again.... I am working in a company which is giving ATM support.In one of my production server a lot of files are getting generated every day. I want to move these files to another name. The file name which is... (4 Replies)
Discussion started by: Renjesh
4 Replies

8. Shell Programming and Scripting

gawk - reading two files & re arrange the columns

Hi, I am trying to read 2 files and writing to the 3rd file if I find the same elements in 2 files. my first file is 1 0 kb12124819 766409 1.586e-01 1 0 kb17160939 773886 8.674e-01 1 0 kb4475691 836671 8.142e-01 1 0 ... (2 Replies)
Discussion started by: ezhil01
2 Replies

9. Shell Programming and Scripting

re arrange data

Any idea in awk or sed? $cat file a b c 2 4 5 6 output: a b c 2 4 5 6 (3 Replies)
Discussion started by: kenshinhimura
3 Replies

10. Shell Programming and Scripting

re arrange the columns

Hi - can any one let me know how to re-arrange the columns of a comma seperated file. The problem here is that the colums some times have new lines and when the columns has new lines or extra comma's then it is enclosed in double quotes("). Can any one tell me how to re-arrange the columns now. ... (0 Replies)
Discussion started by: ahmedwaseem2000
0 Replies
Login or Register to Ask a Question