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.
krypted June 28th, 2015
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.
krypted June 9th, 2013
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
krypted November 1st, 2008
krypted March 8th, 2008
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:
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.
krypted October 7th, 2005