Problem in file usage option


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in file usage option
# 1  
Old 10-22-2010
Problem in file usage option

Hi,

I have a dout in -u option in ls command. If we give ls -lt command it will dispaly the last modfied time. If we give ls -lu command it will display the last usage time of the file.

My doubt here is Please refer the below commands.

Code:
/appldata/rsc/dm/RejectData$ls -lt ppi_amaz_dflt_disc_freq_dist_RejectData.bad
-rw-r-----   1 dqlet1   staff             0 Oct 15 13:11 ppi_amaz_dflt_disc_freq_dist_RejectData.bad
/appldata/rsc/dm/RejectData$ls -lu ppi_amaz_dflt_disc_freq_dist_RejectData.bad
-rw-r-----   1 dqlet1   staff             0 Sep 24 00:59 ppi_amaz_dflt_disc_freq_dist_RejectData.bad

In the above commnds in ls -lu command, i am getting the older date comparing with the timestamp in ls -lt command.

But ls -lu should show the newer timestamp right. Please correct me if i am wrong

Thanks,
Puni

Moderator's Comments:
Mod Comment You should be familiar using code tags instead of using different fonts etc. - I've sent a PM with a guide as reminder, thanks.

Last edited by zaxxon; 10-22-2010 at 04:40 AM..
# 2  
Old 10-22-2010
Hi puni,

no ,it is not correct that the access time is newer than modified time,it depends upon the time you access.

ex
Code:
 cat >test1
this is test1 file

[biswa@dhcppc0 ~]$ cat test1
this is test1 file
[biswa@dhcppc0 ~]$ ls -lt test1
-rw-rw-r-- 1 biswa biswa 19 Oct 22 13:45 test1
[biswa@dhcppc0 ~]$ ls -lu test1
-rw-rw-r-- 1 biswa biswa 19 Oct 22 13:45 test1
[biswa@dhcppc0 ~]$ cat test1u
this is test1 file                                   ----------you accessed here so next access time is changed [biswa@dhcppc0 ~]$ ls -lu test1
-rw-rw-r-- 1 biswa biswa 19 Oct 22 13:46 test1
[biswa@dhcppc0 ~]$ ls -lt test1  -------------------but modified time unchanged
-rw-rw-r-- 1 biswa biswa 19 Oct 22 13:45 test1
[biswa@dhcppc0 ~]$ cat>>test1-----------now you appened means modified so the modtimechang
hello 
[biswa@dhcppc0 ~]$ ls -lt test1
-rw-rw-r-- 1 biswa biswa 25 Oct 22 13:47 test1
[biswa@dhcppc0 ~]$ ls -lu test1
-rw-rw-r-- 1 biswa biswa 25 Oct 22 13:46 test1



hope you will get it

Regards,
sanjay
# 3  
Old 10-22-2010
Hi Sanjay,

Thank you. You are right . In your case usage time is the latest time.
But in my example usage time is older time.

What my doubt here is when the modified time is "Oct 15" how come the last usage time can be Sep 24?

Last usage time should be equal or newer than the modified time right?

Thanks,
Puni
# 4  
Old 10-24-2010
see my last two lines of last post(-lu is 13:46 and -lt it 13:47)
and in your case it is clear no need to be baffled coz since sep 24 the file has not been accessed (it has not been opened ) and on oct 15 some modification is done so modi time is oct15.
I dont know how it confuses you.

Regards,
Sanjay.
# 5  
Old 10-27-2010
Hi sanjay,

Thank you. Still i have confusion with the above point. If file got modified on oct 15 means, file sholud have accessed (i.e, opened) and then can able to modify the file right.

If so , in my point of view file usage time also should be oct 15 , is it correct? Please correct me if i am wrong

Thanks,
Puni
# 6  
Old 10-27-2010
no you are wrong.

Please understand the following point carefully.

1:file can be modified without opening it. That is by cat >> filename here you are appending some text means , modifying it.(so it has no effect on access time).
2.if you are modifying with any editor like vi,vim or any.....and trying to modify some text inside it then you are first accessing it(vi filename) and then modifying it(when you are saving the changes).

hope this time you understood.

anytime welcome
Sanjay
This User Gave Thanks to sanjay.login For This Post:
# 7  
Old 10-27-2010
Thank you sanjay
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with -s option in IF

Hello Guys , I am trying to run below in one of my script but unable to get it succeed . Can anyone help me on this? I am using HP-UX. if then write_log " Both files are present . Mail will be send to respective teams." EMAIL_SUBJECT="MGCA - File Extraction Process COMPLETED"... (12 Replies)
Discussion started by: himanshu sood
12 Replies

2. Shell Programming and Scripting

Problem in Using fgrep Command with pattern file option

Hi, i am using fgrep command with following syntax fgrep -v -f pattern_file_name file file contains few line and have the pattern which i am giving in pattern file. My Problem is : its is not giving any output. while i am using fgrep -f pattern_file_name file it is showing all... (4 Replies)
Discussion started by: emresearch
4 Replies

3. Shell Programming and Scripting

Problem with -c option in Mailx command

Hi, I am using mailx command in shell script. When i put -c option for CC , i get error message as "Unknown flag: -c" . I checked manual of mailx command and found that ~c to be used but after using ~c also it is not working. My shell is Korn. Kindly let me know what i have to do . Thanks (9 Replies)
Discussion started by: krishna_gnv
9 Replies

4. IP Networking

Problem when I Open my WireShark - No Interfaces Option available

Hi gurus of unix, I haved installed my openSolaris in a HP530, Recently I use the following command beadm destry opensolaris1 beadm destry opensolaris2 After That I reboot my Laptop. Well when I go to my work I try to open my wireshark tool, but the option in GUI interface does not appear!!!... (2 Replies)
Discussion started by: andresguillen
2 Replies

5. UNIX for Advanced & Expert Users

Problem with useradd, -p option in Solaris 10

Good day all. I'm trying to add a user with useradd and the -p option to assign a project name, but the result is that the user is created with an error message: "UX: useradd: user.root name should be all lower case or numeric." The command: useradd -d /export/home/tester -g rtpgrp -G... (2 Replies)
Discussion started by: BRH
2 Replies

6. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

7. Solaris

correct usage of find's -prune option

I know one of the more seasoned veterans probably opened this thread looking for their chance to refer me to the site's search feature and let me tell you. I'VE LOOKED!!!! And I didn't find anything helpful... So, I've got a windows background and I'm fond of its search feature which comes... (6 Replies)
Discussion started by: ProGrammar
6 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. UNIX for Dummies Questions & Answers

Usage of prstat -j option.

Hi, I need to capture output of prstat command for certain pid's .I found it as prstat -j filename. I created a filename projlist gave the pid number on the projlist file and run the cmd like this >prstat -j projlist prstat: illegal argument -- projlist can anybody suggest how to... (1 Reply)
Discussion started by: vipin771
1 Replies

10. UNIX for Dummies Questions & Answers

problem in ssh with -i option

Hi All, I want to ssh to a remote terminal i did the following steps 1. On the client run the following commands: 2. $ mkdir -p $HOME/.ssh 3. $ chmod 0700 $HOME/.ssh 4. $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P '' and then tried the following $ ssh -i $HOME/.ssh/id_dsa server ... (1 Reply)
Discussion started by: gauri
1 Replies
Login or Register to Ask a Question