|By Hovhannes Avoyan||
|August 25, 2011 04:30 PM EDT||
In the first part of our series we described how to use find (and locate) to search for files using their names. Today we are going to review how to utilize find in a less common but very useful way. But first a few words on testing (okay, this might not be necessary for everyone, but bear with me!).
1. How to test
It is very important to remember that the find command allows you to create a list of objects having the value of a property the same, greater or smaller then given “n” — which stands for a number of days defined as 24 hours periods, with any frictional part ignored:
- +n – value of file property grater than n,
- n – value of file property the same as n,
- -n – value of file property smaller than n.
2. Search using time related information.
One of the most useful features of find is the ability to separate files based on the time of their creation, access and modification. This is done by the family of “time” tests. In “n” language, 47 hours will be given the same value as 25 hours (n=1). This behaviour can be changed by adding the option “-daystart” (measure time from beginning of today, so “n” for yesterday equals 1 in front of a test. Have a look at these time definitions below:
- -mtime n (Modification TIME) – probably the most useful from time-related tests, allowing to search files based on their modification time. If you want to have a list of all log files modified 2 days ago (or to be precise between 48 and 72 hours ago) you can run:
find /var/log -mtime 2
- -atime n (Access TIME) – the results based on a file’s last access time. If you want to see all logs accessed today you can run:
find /var/log -atime 0
Please remember it might be misleading if you check the file system mounted with option -noatime (which improves performance).
- -ctime n ([status] Change TIME) – this test searches files based on change of status (It means ownership, access privileges or type). For example you want to find which (or any at all) of the files in your home directory have changed status in the last 48 hours (which might indicate problems) you can run:
find ~ -ctime -1
Measuring time in days is not always very handy. Sometimes it is necessary to find more recent changes. To make it possible, the above test has minuets-base equivalents:
- -mmin n – test modification time but in minutes rather than days;
- -amin n – test access time but in minutes rather than days;
- -cmin n – test status change time but in minutes rather than days.
Imagine the following situation: You have downloaded a file under five minutes ago, but you are not sure where you have saved it. You can try the following command:
find ~ -mmin -5
In this scenario mmin can be change to amin or cmin, because all “three times” have the same initial value.
Lastly, there are tests allow you to search files in relation to a property of another file. For example:
- -newer file – returns files modified more recently than the given file,
- -anewer file – return files accessed more recently than the given file,
- -cnewer file – return files with the status changed more recently than for the given file.
For example, the following command will list all files accessed later than file DSCF1002.avi in directory /home/movies:
find /home/movies -anewer DSCF1002.avi
There is also a fourth ‘newer’ test:
- -newerXY reference – which compares timestamp with the given timestamp of the reference file. XY has to be substituted by one or two from the following timestamp type:
- a – access time,
- B – birth (creation) time,
- c – inode status change time,
- m – modification time,
- t – reference is interpreted directly as a time.
Please remember that not all combinations are supported (notable X cannot equal t) and B is not supported on all systems. For example, to get the list of all files accessed in /var/cache later than (in BST) July 20th 10:45:32 2011:
find /var/cache -newerat ‘Jul 20 10:45:32 BST 2011’
To create another list with files modified later than the last access to your .profile file:
find /var/cache -newerma ~/.profile
There is one more test that allows you to search based on a time-related parameter:
- -used n – creates the list of files accessed “n” days after its status was last changed. To find not very often accessed files (let say one month) in /var directory, use this command:
find /var/ -used +30
Appendix. ls and time
You can try to create similar lists with a little help from the ls command. There are three ls commands that correspond to the above find test. They allow you to sort files according to:
- -t – modification time (mtime);
- -u – access time (atime);
- -c – status change time (ctime).
Option -t simply sorts by modification time, but option -u and -c behave different in connection with other options:
- ls -u – sorts by access time (receptively ls -c sorts by status change time);
- ls -ul – shows access time but sorts by name (ls -cl – shows status change time but sorts by name);
- ls -ult – shows and sorts by access time (ls -clt – shows and sorts by status change time).
In his General Session at 16th Cloud Expo, David Shacochis, host of The Hybrid IT Files podcast and Vice President at CenturyLink, investigated three key trends of the “gigabit economy" though the story of a Fortune 500 communications company in transformation. Narrating how multi-modal hybrid IT, service automation, and agile delivery all intersect, he will cover the role of storytelling and empathy in achieving strategic alignment between the enterprise and its information technology.
Jan. 18, 2017 04:45 PM EST Reads: 4,507
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists peeled away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud enviro...
Jan. 18, 2017 04:30 PM EST Reads: 4,685
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
Jan. 18, 2017 03:30 PM EST Reads: 3,667
"LinearHub provides smart video conferencing, which is the Roundee service, and we archive all the video conferences and we also provide the transcript," stated Sunghyuk Kim, CEO of LinearHub, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Jan. 18, 2017 02:45 PM EST Reads: 1,585
Things are changing so quickly in IoT that it would take a wizard to predict which ecosystem will gain the most traction. In order for IoT to reach its potential, smart devices must be able to work together. Today, there are a slew of interoperability standards being promoted by big names to make this happen: HomeKit, Brillo and Alljoyn. In his session at @ThingsExpo, Adam Justice, vice president and general manager of Grid Connect, will review what happens when smart devices don’t work togethe...
Jan. 18, 2017 02:00 PM EST Reads: 375
"There's a growing demand from users for things to be faster. When you think about all the transactions or interactions users will have with your product and everything that is between those transactions and interactions - what drives us at Catchpoint Systems is the idea to measure that and to analyze it," explained Leo Vasiliou, Director of Web Performance Engineering at Catchpoint Systems, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York Ci...
Jan. 18, 2017 01:00 PM EST Reads: 5,593
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Jan. 18, 2017 01:00 PM EST Reads: 5,097
Discover top technologies and tools all under one roof at April 24–28, 2017, at the Westin San Diego in San Diego, CA. Explore the Mobile Dev + Test and IoT Dev + Test Expo and enjoy all of these unique opportunities: The latest solutions, technologies, and tools in mobile or IoT software development and testing. Meet one-on-one with representatives from some of today's most innovative organizations
Jan. 18, 2017 12:15 PM EST Reads: 1,526
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Jan. 18, 2017 12:00 PM EST Reads: 4,228
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in Embedded and IoT solutions, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 7-9, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/Big Data, HPC and E...
Jan. 18, 2017 12:00 PM EST Reads: 5,755
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
Jan. 18, 2017 12:00 PM EST Reads: 1,941
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
Jan. 18, 2017 10:30 AM EST Reads: 3,103
"Matrix is an ambitious open standard and implementation that's set up to break down the fragmentation problems that exist in IP messaging and VoIP communication," explained John Woolf, Technical Evangelist at Matrix, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Jan. 18, 2017 09:45 AM EST Reads: 11,553
WebRTC sits at the intersection between VoIP and the Web. As such, it poses some interesting challenges for those developing services on top of it, but also for those who need to test and monitor these services. In his session at WebRTC Summit, Tsahi Levent-Levi, co-founder of testRTC, reviewed the various challenges posed by WebRTC when it comes to testing and monitoring and on ways to overcome them.
Jan. 18, 2017 08:15 AM EST Reads: 5,977
"A lot of times people will come to us and have a very diverse set of requirements or very customized need and we'll help them to implement it in a fashion that you can't just buy off of the shelf," explained Nick Rose, CTO of Enzu, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jan. 18, 2017 07:45 AM EST Reads: 4,633
DevOps is being widely accepted (if not fully adopted) as essential in enterprise IT. But as Enterprise DevOps gains maturity, expands scope, and increases velocity, the need for data-driven decisions across teams becomes more acute. DevOps teams in any modern business must wrangle the ‘digital exhaust’ from the delivery toolchain, "pervasive" and "cognitive" computing, APIs and services, mobile devices and applications, the Internet of Things, and now even blockchain. In this power panel at @...
Jan. 18, 2017 06:45 AM EST Reads: 2,765
Every successful software product evolves from an idea to an enterprise system. Notably, the same way is passed by the product owner's company. In his session at 20th Cloud Expo, Oleg Lola, CEO of MobiDev, will provide a generalized overview of the evolution of a software product, the product owner, the needs that arise at various stages of this process, and the value brought by a software development partner to the product owner as a response to these needs.
Jan. 18, 2017 06:30 AM EST Reads: 1,186
WebRTC services have already permeated corporate communications in the form of videoconferencing solutions. However, WebRTC has the potential of going beyond and catalyzing a new class of services providing more than calls with capabilities such as mass-scale real-time media broadcasting, enriched and augmented video, person-to-machine and machine-to-machine communications. In his session at @ThingsExpo, Luis Lopez, CEO of Kurento, introduced the technologies required for implementing these idea...
Jan. 18, 2017 06:30 AM EST Reads: 4,633
The WebRTC Summit New York, to be held June 6-8, 2017, at the Javits Center in New York City, NY, announces that its Call for Papers is now open. Topics include all aspects of improving IT delivery by eliminating waste through automated business models leveraging cloud technologies. WebRTC Summit is co-located with 20th International Cloud Expo and @ThingsExpo. WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web co...
Jan. 18, 2017 05:45 AM EST Reads: 2,915
Internet of @ThingsExpo, taking place June 6-8, 2017 at the Javits Center in New York City, New York, is co-located with the 20th International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. @ThingsExpo New York Call for Papers is now open.
Jan. 18, 2017 05:15 AM EST Reads: 3,594