Find the answer to your Linux question:
Results 1 to 5 of 5
Dear Experts, If I've opened a file ( vi filename) and then written something in that, and then did a " :wq " with save and exit. I think by ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    40

    File time stamp don't get changed? Is this possible ?


    Dear Experts,

    If I've opened a file (vi filename) and then written something in that, and then did a ":wq" with save and exit.

    I think by doing this the file get updated with latest time stamp.

    Is this possible to keep the file time stamp as it was eariler ? even If I am editing to the file today.

    Is this possible, or just a silly question of mine?

    Any help...please


    Thanks-
    Pawan

  2. #2
    Just Joined! cfajohnson's Avatar
    Join Date
    May 2007
    Location
    Toronto, Canada
    Posts
    52

    Use the touch command to reset it.

  3. #3
    Just Joined!
    Join Date
    Jun 2006
    Posts
    40
    Quote Originally Posted by cfajohnson View Post

    Use the touch command to reset it.
    Thanks Chris...

    Using touch will update the file with latest time stamp (I assume the file already exists). But, my concern was to keep the older time stamp as it is, even If I am updating/editing the file today. Is this possible ?

    Thanks-
    Pawan

  4. #4
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,758

    Smile

    Quote Originally Posted by Pawan Sangal View Post
    Thanks Chris...
    Using touch will update the file with latest time stamp (I assume the file already exists).
    Yes,if file already exists touch will update it's time stamp to reflect current time.
    If file didn't exists already, then it will create an empty new file.

    But, my concern was to keep the older time stamp as it is, even If I am updating/editing the file today. Is this possible ?
    Linux already has noatime - It will not update the last accessed time.

    The atime and noatime attribute

    But i'm not heard about nomtime ..
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  5. #5
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,286
    Hi.

    The command touch can alter the time to a specific value:
    -d, --date=STRING
    parse STRING and use it instead of current time

    -- excerpt from man touch
    So, for example, if you were to capture the exiting mtime of a file, edit the file as you desire, then you could use touch to reset the mtime as originally existed.

    The man and info pages are your friends ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

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