Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am using Red hat Linux operating system.I want change the date exactly 5 years ago to current date with out providing month, date and time. I want only the year should be 5 years ago .please help in this regard
example
If current date is this = Wed mar 18 22:59:23 IST 2010
past date shuld be like this= Sat Mar 18 22:59:23 IST 2005
I am using Red hat Linux operating system.I want change the date exactly 5 years ago to current date with out providing month, date and time. I want only the year should be 5 years ago .please help in this regard
example
If current date is this = Wed mar 18 22:59:23 IST 2010
past date shuld be like this= Sat Mar 18 22:59:23 IST 2005
use date --date=years ago
sorry if you only want certain parts use the
Code:
[root@xxx ~]# date --date='5 years ago'
Thu Mar 17 14:27:33 GMT 2005
Hint: you can do this by running the date command twice in the same commandline. Ie one invocation to print the date which is used as input to set the date. However I can imagine that doing this could cause all sorts of problems to running processes.
What may be a safer way is to reboot and reset the date in the bios, then when your system boots up it will read that date... I would still anticipate problems though, sicne you will have many files on your file systems that your os will think are dated up to 5 years in the future. You could play another trick by booting off a live cd, then mounting your drives and then use find and touch to change all the timestamps.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.