Terminal Tidbits: mdfind

Last week we discussed the locate command, and the week before, the find command. This week I will talk about mdfind: how to use it, and how it differs from the previous two commands.

mdfind indexes files on your OS that are used with Spotlight. It also searches user and system files by default and will even allow the user to search by file content and name. It is a bit more comprehensive than both the locate and find commands. The mdfind syntax is as follows:

mdfind name

I deal with a lot of invoices at work and often am searching for the correct one. mdfind helps out a lot in this regard. I need to find an invoice that was made for a local airport. I can’t remember the name but I do remember where it is located. First I navigated into my desktop folder, next I ran the command mdfind invoice. As you can see I have more results than I want.

I need to narrow down the search by providing a term. Since I am looking for an invoice related to airport, I will include that in the command. All words used in the search term are and’d together. Because of this I need to pass them as one argument and use double quotes. Now take a look at what it returns; the only invoice matching what I need.

The main purpose of these last three TT articles was just to show you how powerful Terminal can be, but I in no way have even scratched the surface. Please try and use these three commands to search for things you already know are there to get a hand of it, and then expand by using the “man find” command. Running “man” in front of any command will bring you to that specific commands manual page allowing you to see more in depth examples.

Similar Posts

  • Charge Safe with a REAL MagSafe

    Most of us have had the need to buy a second MagSafe charger for our Apple laptop at some point. Maybe our old charger has worn out over the years of use, or we simply want an additional one to keep at our home or workplace.

    There are many different types of MagSafe chargers for sale on various websites. Many of the chargers that can be found for sale are not manufactured by Apple. These third-party chargers are typically much cheaper than the official Apple chargers, but can be dangerous to use. Third-party MagSafe chargers can shorten the life of your computer’s battery, or even damage the computer by causing the battery to expand. Expanding batteries can damage the main logic board, top case, or other expensive components of the laptop. There have even been reports of third-party MagSafe adapters igniting during normal use.

    It is always recommended to use an official Apple MagSafe charger if one is available. You can ensure that you will receive an official charger by ordering directly from Apple or from an Apple Authorized Reseller like Small Dog Electronics.

  • _Hello Fellow Technophiles,_

    We have become so accustomed to computers that devices that would have been considered too powerful to even imagine are now commonplace. We don’t even consider items like an iPhone a computer, even though the current generation has processors that would blow away the most powerful machine from just a few years back. And let’s not forget all of the household items from our cars to our washing machines that have imbedded processors in them. Once all of these devices are connected to the so-called “Internet of things” it will truly be a worldwide web.

    As this ever faster progress marches on, I want to take a minute to acknowledge one of the ancestors of all of our computers today: ENIAC. Short for Electronic Numerical Integrator And Computer, this machine is considered by some to be the first true general purpose computer. This device cost over six million dollars (adjusted for inflation) and was HUGE. How big? According to Wikipedia:

    bq. ENIAC contained 17,468 vacuum tubes, 7200 crystal diodes, 1500 relays, 70,000 resistors, 10,000 capacitors and approximately 5,000,000 hand-soldered joints. It weighed more than 30 short tons (27 t), was roughly 2.4m x 0.9m x 30m (8 x 3 x 100 feet) in size, occupied 167m2 (1800 ft2) and consumed 150 kW of electricity.

    ENIAC day is celebrated on February 15th, and this year marked the 70th anniversary of its dedication. To celebrate, I offer this statement in a language ENIAC would understand:

    01001000 01100001 01110000 01110000 01111001 00100000 01100010 01101001 01110010 01110100 01101000 01100100 01100001 01111001 00100000 01000101 01101110 01101001 01100001 01100011 00100001

    Mike
    “*michaeld@smalldog.com*”:mailto:michaeld@smalldog.com

  • Surf Safe: A Cautionary Tale

    One of my first TT articles was a piece on a cold calling scam where someone would call you out of the blue and say that you have an issue with your computer and they had a fix: “Just let me remote in, install some software and for ONLY 200 dollars all of your problems are gone!” In the article I mentioned that this called a “phishing scam.” Well folks today we’ll talk about essentially the same scam but different rods and bait.

    The scammers have gotten more high tech and are taking more risks. Instead of cold calling people out of blue, they are DNS hijacking (that is a whole other can of worms) advertising servers and are then using their scripts instead of the real code. If you accidentally click on one of these pages, you will get their script using event handlers which consist of a “alert command” and a “ONLOAD command” which display a message such as: “Your Macintosh has been infected!!! Please call this number for further assistance.”

    Now working as a technician, I have heard many times that a customer let a stranger remote in to fix a problem that didn’t exist. I wondered “what is the end game here?” When one of these victims came in to make sure her computer was safe to use, she still had the number that she called handy. I decided to play the victim and call to see what happens.

    Before I did this, I did some prep work. First I used a fresh install of OS X with no third party software. I dd not use my home or work wifi network; I used a public one. Now I was all set up with a fresh copy of El Capitan on a MacBook Pro 2010 and phone number in hand.

    I dialed the 1-888 number provided and a nice person answered: “Hello, this is Rebecca. I’m with from COMPANY X. What is your issue?” I replied in a scared tone that I was surfing the web and got a pop-up on my screen that my Mac was in trouble and might you be able to help? “Sure, sir, we can help!” she responded.

    She instructed me to go to a website which was very primitive; just a page with three links: remote help for Windows, Mac, and Linux. The link installed a program called Team Viewer. She took control of my machine and opened System Preferences and a Terminal window and ran the *netstat* command, which is used for finding problems in the network and to determine the amount of traffic on the network as a performance measurement. It has NOTHING to do with malware, but she insisted that the other computers on this public wifi network were the “bad guys” trying to get into my machine. Then, in System Preferences she clicked on Security and Privacy and showed that a firewall was not installed, and she said she could transfer me to a technician and for a mere $199.99 they could fix it!

    At this point I decided to let her know that she was talking to a IT professional and hung up the phone. As soon as I hung up, I quickly disconnect the remote session and started to run malware scans. The scans came back clean; these scammers just wanted to scare a credit card number out of me.

    Don’t let them fool you! If you think your computer may have a problem, give us a call instead.