LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-01-2013, 09:58 AM   #1
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Rep: Reputation: Disabled
somebody please help me to understand this question


Destribution : Rhel 6

Question: create a file /root/filetest1 with month update two months before..

somebody please help me to understand this question
 
Old 08-01-2013, 10:06 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by P.B View Post
Destribution : Rhel 6
Question: create a file /root/filetest1 with month update two months before..
somebody please help me to understand this question
No idea, especially since you don't provide a context, and the question isn't phrased correctly. Is that the EXACT question, and exactly how it's written, because in English, that doesn't make grammatical sense.

If you mean you want the date of a file to be two months in the past, then you need to read the man page on the touch command.
 
Old 08-01-2013, 10:14 AM   #3
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Original Poster
Rep: Reputation: Disabled
ya its written in that way only...

the answer is also given but i am not getting the meaning of the answer also

here it is

touch -t 201301201048 /root/filetest1
 
Old 08-01-2013, 10:19 AM   #4
dt64
Member
 
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 218

Rep: Reputation: 38
that sounds like you are doing something like a RH033 Basic Essentials Course...
If that's the case have a read in your provided papers but always remember: there is more to read (man pages, books, online stuff...)
 
Old 08-01-2013, 11:10 AM   #5
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Code:
man touch
......
-t STAMP
       use [[CC]YY]MMDDhhmm[.ss] instead of current time
http://linux.die.net/man/1/touch
 
1 members found this post helpful.
Old 08-01-2013, 11:21 AM   #6
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
Code:
man touch
......
-t STAMP
       use [[CC]YY]MMDDhhmm[.ss] instead of current time
http://linux.die.net/man/1/touch
thnkx...i think i have got the answer
 
Old 08-01-2013, 11:32 AM   #7
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
but that means you have to workout what the date was 2 months ago..

date --date='-2 month'

I'll let you workout how to get that into the touch in the appropriate format

man date
and

http://www.tldp.org/LDP/abs/html/commandsub.html

will help
 
1 members found this post helpful.
Old 08-01-2013, 11:42 AM   #8
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
Code:
man touch
......
-t STAMP
       use [[CC]YY]MMDDhhmm[.ss] instead of current time
http://linux.die.net/man/1/touch
thanks , what it does actually ..create a file with a time stamp of 2 months back!!! please give an idea , its not clear from the man page
 
Old 08-01-2013, 11:43 AM   #9
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by P.B View Post
thanks , what it does actually ..create a file with a time stamp of 2 months back!!! please give an idea , its not clear from the man page
[[CC]YY]MMDDhhmm[.ss] --- what is meant by the CC written at first !!
 
Old 08-01-2013, 12:13 PM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by P.B View Post
thanks , what it does actually ..create a file with a time stamp of 2 months back!!! please give an idea , its not clear from the man page
Well, a time stamp of 2 months back means exactly that: the date that it was two months ago. Just like "three days back" would mean three days ago, etc. Simple.
Quote:
Originally Posted by P.B
[[CC]YY]MMDDhhmm[.ss] --- what is meant by the CC written at first !!
...and a brief search would tell you that the "CC" means the first two digits of a year, which are optional.

Most of your questions seem like verbatim homework assignments, and show very little effort of your own.
 
Old 08-01-2013, 01:00 PM   #11
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Original Poster
Rep: Reputation: Disabled
Lightbulb

Quote:
Originally Posted by TB0ne View Post
Well, a time stamp of 2 months back means exactly that: the date that it was two months ago. Just like "three days back" would mean three days ago, etc. Simple.

...and a brief search would tell you that the "CC" means the first two digits of a year, which are optional.

Most of your questions seem like verbatim homework assignments, and show very little effort of your own.
wow ..what a good guess TBOne ...you are a genius ..and i am an ordinary beginner ..

thanks a ton to all those bothered to answer my question and help me to understand the usage of touch -t.
 
Old 08-01-2013, 01:08 PM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by P.B View Post
wow ..what a good guess TBOne ...you are a genius ..and i am an ordinary beginner ..
It was not a guess, and you could easily have found all this out, had you tried to research any of it on your own FIRST.
 
Old 08-01-2013, 01:24 PM   #13
P.B
LQ Newbie
 
Registered: Feb 2013
Location: INDIA
Distribution: RHEL6
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
It was not a guess, and you could easily have found all this out, had you tried to research any of it on your own FIRST.
Sir..I am also learning from all of you how to research and proceed ...one just can not research blindly...that's why people need a mentor ..and in my case this forum , all of you are acting as my guru...i can understand that my questions seems to a guru like you is a very stupid one ... but please understand whenever i am getting stuck , not finding a way out ..i am coming here and people here are so good and helpful ..they are guiding me like a father to a child.. ...In case of this question i got the first clue ...when i got the reply "date --date='-2months' .. it clicked and showed me the way to research further....sorry to disturb you all with my silly questions sir..but i am helpless...assuring you day by day quality of my questions is going to improve...i am confident enough ...all that i need is your support...hope to get it throughout my technical journey with Linux.
 
Old 08-01-2013, 01:34 PM   #14
911InsideJob
Member
 
Registered: Jul 2013
Distribution: Mint KDE
Posts: 74

Rep: Reputation: Disabled
It was a stupid question and a stupid answer written by a stupid teacher. If they were trying to teach you how to use the help system then they obviously failed miserably. Someone might want to recover the file as it was before 2 month worth of stupid changes but in the real world you'll probably only use touch to create an empty file.
$ touch stupid.txt
 
Old 08-01-2013, 01:42 PM   #15
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by P.B View Post
Sir....

You have to understand that many people just come on here and ask direct questions, without first doing proper research.
The fact that your question is obviously related to some course and appears to be an "end of chapter exercise" is worrying, and "annoying"

Really you need to go back to the beginning and work through the book again.

if you are ever stuck with a command ( even if not, worth a look for the extras )
command --help ( sometimes -h or -help )
man command
info command
websearch : " command tldp " ( other things to include are linux bash shell )
tldp is "The Linux Documentation Project"

When you ask a question, give a little background
show what you have tried, what you expected and how the results are not what you expected.

show sample data that represents any input, and what output you want from that.

and don't get angry because someone got angry because they thought you were being lazy


looking forward to your answer to the question in OP
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: A Question & Answer series that will help you understand the intricacies of both sudo and su LXer Syndicated Linux News 0 06-27-2013 10:00 PM
an other C question. I dont fully understand this bit of code lleb Linux - Software 22 06-13-2013 04:57 PM
How to understand question: The /home should be expanded to take 500MB total space rhel6_user123 Linux - Newbie 1 05-15-2011 03:27 PM
C++ Unions to understand - question vargadanis Programming 14 04-19-2007 11:49 PM
Question about threads (I don't understand how they work) zahadumy Programming 10 12-13-2005 12:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration