For todays article I wanted to put together a quick little cheat sheet for some GNU find command examples.
Some of these commands will be basic some will be more advanced, but they all will be useful. As a caveat some commands don't work in all Unix environments and this is especially true with older releases. If you find yourself in one of those situations there is a way to make the find command work you will just need to use different methods like the -exec flag.
This is a quick and easy tip for the day.
imadmac:~ madflojo$ uname -a Darwin imadmac.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 The example is from my imac but it works on unix/linux in general.
This is actually one of my favorite questions to ask Jr. Systems Administrators. I believe the way they answer this question really helps me gauge where they are at in their Administration skills.
How do you clear a large log file that an application is actively writing to?
Some will answer honestly and say “by removing the file” and others will pretend like they careful of everything and say “move the file out of the way and create a new one”.
A friend of mine had a question on how to edit a huge (like as in xbox hueg) file without using vi. He probably didn't want to use vi because when you vi a file it will load the entire file into memory. This can be very bad if your system doesn't have enough memory to accommodate the file size.
So how do you edit a specific line of a file without loading it into memory?