UNIX Find And Execute

Zach tells me I need to post how to find files and execute a command on those files. While the man pages are always the definitive reference, these are the options I use frequently. As usual, anything in italics should be replaced with the details for your search.

Note: WordPress loves to convert quotes into fancy quotes (pointing in from each side) so these commands may not work too well if copied and pasted. On the bright side, there’s no time like the present to start commiting these to muscle memory.

Find a file and execute a specific command:

find path conditions -exec command {} \;

find ./ -name "*.php" -exec cat {} \;

The open/close curly bracket marks where the name of each file found will be substituted and the backslash-semicolon marks the end of the command to execute.

Here are a few other options I use frequently:

Search for a file by name:

find path -name filename

find ./ -name style.css

Search by name with wildcards:

find path -name "filename"

find ./ -name "*.html"

Search for files modified within the past n days:

find path -mtime -n

find ./ -mtime -7

Search for files modified before the past n days:

find path -mtime +n

find /tmp -mtime +3

These are mostly based on my experience in Solaris using the bash shell. They should work just about everywhere, but check the man pages as mileage will vary.

Easy Linux CommandsFor more tips like this check out my book Easy Linux Commands, only $19.95 from Rampant TechPress.

Buy it now!


unix, solaris, linux, mac osx, osx, sysadmin, systems administration

Sun Fire T2000 vs. Sun Fire V440

SunFireT2000Thanks to the diligence of my coworker Scott Maziarz we have been able to run some practical performance tests on the new Sun Fire T2000 we got on a try and buy program from Sun.

About our environment

While we’re not truly equipped for traditional load testing here at Plymouth State University I decided early on that our daily datamart scripts would be a good test of this system’s capabilities. These scripts are a combination of vendor supplied and homegrown code which create datamarts for reporting. The scripts run separately take between a minute and several hours to complete. They rely heavily on joins and functions so, while there is a fair amount of disk I/O, the speed of the processors and memory should play a large role.

Oracle 9iR2 was used for the testing on both systems. The database configuration was not altered, so despite the point that the T2000 has twice as much memory as our V440s (16GB versus 8GB) Oracle will be using the same amount of memory on both systems. We also unfortunately did not have the opportunity to do any performance tuning on the T2000. As such I consider this a comparison with a straight out of the box T2000. With some careful system tuning the T2000 would probably perform even better.

The two systems

Sun Fire T2000

  • 8 core 1.0GHz UltraSparc T1Processor
  • 16GB memory
  • 2 * 73GB 10K RPM SAS hard disk drives

Sun Fire V440

  • 4 * 1.0GHz UltraSparc IIIi
  • 8GB memory
  • 4 * 73GB 10K RPM Ultra320 SCSI hard disk drives

While these two systems are different in many ways they are comparable in price (the V440s are actually quite a bit more expensive, but this one is around two years old now.) All testing was done on internal disks making the results dependant on the entire system performance.

Oracle was not reconfigured to take advantage of the extra memory in the T2000.

The tests

For the testing we chose a set of 19 datamart creation scripts which we run daily in our production environment. To assure that there is no additional load on the V440 we ran the tests on our reporting instance which is on a relatively idle system.

The first test is to run the 19 datamart scripts staggered. This is how we run them in production. Four scripts are started every half hour to spread out the load on the server. There’s a lot of overlap, but the staggering is enough to keep the system responding normally.

Scripts running staggered

The graph above represents the runtime of each job individually. A shorter line represents a quicker runtime and we can see that the T2000 consistently outperformed the V440 often running n a quarter the time!

The total runtime for all 19 jobs was 2915 minutes on the V440 and 847 on the T2000. On average it took only 29% as long for the jobs to run on the T2000!

For the second test we ran all 19 jobs at once.

Scripts running simultaneous

We still see a significant improvement in performance, but not as high as when these were run staggered. Here the T2000 completed the tasks in 59% of the time of the V440. I attribute this to contention for disk on the T2000.

Thanks to Scott Maziarz for running the bulk of these tests and compiling the results for me.

Conclusions

The Sun Fire T2000 has certainly proven its worth. Some may be put off by the relatively low processor speed (the model tested was a mere 1GHz) but it is clearly not an impediment. The 8 core CPU seems to be up to the challenge and I’m sure with additional tuning I’m sure they’d scream.

With increased performance and higher efficiency than the comparably priced V440, the T2000 will definitely be in our future. The lower energy consumption and lower heat output would be a welcome change in our already taxed data center and the compact 2U size should be an easy fit in any rack.

Check out more details at Sun’s website and if you’re still not convinced apply for your own free 60-day trial!

sun, sun fire t2000, t2000, server, systems administration, database administration, dba, oracle, rdbms, sysadmin, sun microsystems

Pineapple Bomber


Fill a pint glass with ice. Add:

  • 1.5 oz Amaretto
  • 1.5 oz Southern Comfort
  • 1.5 oz Pineapple Juice

    Shake or stir well and serve.

    These are quite sweet, but very good.

    alcohol, drink, drinking, beverage

Got Milk?

Cat MilkI’ll bet you don’t have this milk in the frige! Donald Burleson, who routinely posts funny articles on his consulting companies Oracle news page has posted two hilarious articles on alternatives to the traditional cow’s milk.

With the growing popularity of bison as an alternative to beef I’m sure it won’t be long until we see these healthy, gourmet products in the dairy case!


Horse milk

Horse milk has long been a popular gourmet food with a uniquely delicious flavor and subtle nuances found in no ordinary dairy product. Horse milk has fruity undertones, a smooth finish and is now joining truffles and Beluga caviar as one of the most coveted treats on the world. Let’s take a closer look and see why horse milk is taking the gourmet scene by storm.

Full article


Cat Milk

With cat’s milks robust undertones, cat milk is now joining the gourmet scene as one of the most coveted treats on the world. Let’s take a closer look at cat milk and see why cat milk is taking the world by storm.

Full Article


humor, funny, fun, milk, diary, food