Tiny Deathstars of Foulness

You can redirect a log file into a given directory. That directory, if it has other stuff in it, can get out of control. So, here, we’re going to remove all files except that file using the find command: find * ! -name jamf.log -type f -delete Once run, the jamf.log is the last file left in the directory.

June 28th, 2015

Posted In: Mac OS X, Mac Security, Ubuntu, Unix

Tags: , , , ,

When doing a data migration in OS X, you find that you often want to build a list of files on the source and the target media and then compare the two lists. When you do such a copy it’s important to verify that the data is all there. To find all the files on a drive, use the find command. If you’re in the working directory of the volume you’re transfering files from, the following command would show you all of the files on the volume: find . -name "*" To dump the contents to a file, use the > followed by the filename. So to list the contents of a volume into a file called source.txt, use: find . -name "*" > source.txt To do the same on the target volume, change the working directory to the target location and re-run, this time with a different name, like target.txt: find . -name "*" > target.txt To then compare the two, you could use diff: diff source.txt target.txt You could also use a third party tool to compare the files graphically. While there is a tool built into OS X for this, I like to use TextWrangler.

June 9th, 2013

Posted In: Mac OS X, Mac OS X Server, Mass Deployment

Tags: , , , , , , ,

Using the find command is a little weird to people who are used to using locate.  However, it is far more powerful and doesn’t come with the indexing requirements that locate does.  So, if you’ve been using locate try and get familiar with using something like this instead (looking for slapd.conf – you can change that as needed): find / -name “slapd.conf” -print

November 1st, 2008

Posted In: Mac OS X, Mac OS X Server, Unix

Tags: ,

Granted it really doesn’t matter any more now that they’re not allowed, but if you need to find them here ya’ go:
find / -type f ( -perm -4000 -o -perm -2000 ) -exec ls -al {} ; 2>/dev/null

March 8th, 2008

Posted In: Mac OS X, Mac OS X Server, Mac Security

Tags: , ,

Mac OS X has a number of commands that will help you find things.  There’s find, grep and way more.  But the easiest of them all to use is locate.  To run locate simply type the word locate from within terminal followed by the case sensitive string of what you are looking for.  For example, if you want to find all files with the word Krypted in the name use the following command:
locate Krypted
Keep in mind when using the locate command that it will also find files that have the name in the path, so if I have a folder called Krypted, every single file in that folder will appear.

October 7th, 2005

Posted In: Mac OS X, Mac OS X Server

Tags: , , , , , ,