iCloud Find My
Use the map to get a full picture of where your devices are — and where a missing one might be. Get help finding them in the Find My app or the Find My widget, which lets you track your devices at a glance, right on the Home Screen of your iPhone or iPad. Whatever method your situation requires, no one should be surprised that Linux provides enough options that you can find the one that suits your particular needs.
But sometimes — depending on what you’re trying to achieve — you may not have another option. And if you’re invoking a new shell each time to launch the command, that overhead gets worse. Purely for reasons of demonstrating using -exec with two commands, we’re also calling the basename command to see the name of the file without its path.
When we run that command we see the output of wc. The -exec (execute) option has a syntax similar to but different from the xargs command. Effectively, xargs constructs a long command line for wc with each of the filenames in it. This command pipes all the filenames into wc at once.
Invite people to share their location with you, using Find My friends. When you enable Find My on your device, Activation Lock is turned on automatically. Activation Lock is designed to prevent anyone else from using or selling your device. If you retrieve it, you can restore your data from your iCloud backup. You may want to erase it remotely to delete your personal data and reset your iPhone, iPad, Apple Watch, or Mac. Worried that your device has fallen into the wrong hands?
So the command that is launched isn’t running in a shell at all. By substituting a plus sign “+” for the terminating semicolon “;” we can change -exec’s behaviour to operate on all files at once. The -c (byte count) limits its output to the number of bytes in each file. Each line of output is an independent line of text. This means wc is called repeatedly, once for each file.
Nearby devices securely send the location of your missing device to iCloud, then you can see where it is in the Find My app. Find My can even let you know if you leave your devices in an unfamiliar location. Some devices, like iPhone, can still send their location for up to 24 hours after they’ve been turned off or have low battery life. The Find My app makes it easy to keep track of your Apple devices — even if they’re offline.
The humble find command really packs some power. For example, it can search for empty files, executable files, or files owned by a particular user. It can search for files and directories using a whole raft of different criteria, not just filenames. The Linux find command is powerful and flexible.
That works just fine with a normal command-line invocation. This computer has a shell function defined called words-only. Without a shell, you can’t get shell expansion of wildcards, and you don’t have access to aliases and shell functions.
There’s a CPU load and time penalty for repeatedly calling a command when you could call it once and pass all the filenames to it in one go. The find command can’t find the shell function, and the -exec action fails. If we try to invoke that function using find’s -exec option, it’ll fail. The -exec (execute) Find an inspection report and registered childcare on reports.ofsted.gov.uk option doesn’t launch the command by running it in the current shell.
