Linux - NewbieThis 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
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.
What command should I use to find out which files have been modified in the last 30 days, and what command should I use to copy these files to my home directory?
It's my second day working with Linux...
Please come back and let us know what you come up with. I'm sure that folk on here will help refine your command for you if you just show us what you have produced so far.
even if it's implicit in your example, you should get into the habit of specifying your search starting point (e.g.: find . -type f <some_other_options>)
there is no minus after -mtime option (-mtime 30)
you still need to use the -exec option for what you want to accomplish in fine with your files (you will need "{}" that represents your current file to be moved with mv)
PS: as stated by hydrurga, please write a more appropriate title for your thread.
There is a minus sign in front of 30.
-mtime -n: Modified LESS than n days ago
-mtime +n: Modified MORE than n days ago
Without '+' or '-' it is exactly 30 days IIRC.
I firmly suggest you not do it. Computer clocks often go wrong, it's a completely un-reliable thing to do to rely upon clocks. You could easily clobber files un-intentionally.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by X-LFS-2010
I firmly suggest you not do it. Computer clocks often go wrong, it's a completely un-reliable thing to do to rely upon clocks. You could easily clobber files un-intentionally.
That is a strange statement. When installed properly a computer syncs time with NTP. And even when it not does it, time is synced with the HW clock at every boot.
If this were true, any backup and restore scheme and any action depending on a file's timestamp should be unreliable.
The OS's file routines makes strong assumptions about the time being correct and procedures have been implemented at great length to keep the system clock correct. Like unprivileged users cannot change the time. NTP is not allowed to make time jumps while adjusting.
Can you justify this claim?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.