mac

Unix find command: How to move a group of files into the current directory

I just bought a bunch of MP3 music files from Amazon, and when I downloaded the zip file they provide onto my Mac, it was a bunch of files in a bunch of subdirectories; not really convenient to work with when you’re trying to import them into iTunes. So I used this Unix find command to move all of the music files from the subdirectories they were scattered in into the root directory that was created when I expanded the zip file:

cd Amazon-Music-Folder
find . -type f -exec mv {} . \;

If you ever need to either copy or move a bunch of files with a single command, I hope this example shows the correct find command syntax for your needs. (If you need to copy the files, use the cp command instead of the mv command.)

Why is my MacBook warm when the lid is closed (in sleep mode)?

Table of Contents1 - Troubleshooting2 - My solution3 - Possible problem: Energy Saver settings4 - Possible problem: Bluetooth settings5 - More information6 - Summary

When I woke up last night it was a little windy outside, so I decided to unplug my MacBook because the power tends to flicker here. When I picked up the MacBook I noticed that it was very warm, even though the lid was closed and it was in sleep mode. This morning I decided to dig into the “Why is my MacBook hot even though the lid is closed and it’s in sleep mode” question.

Notes from February 4, 2018 (decision journals, Mayan civilization, more)

Farnam Street has been an interesting blog lately, including this post about keeping a decision journal, and this post about the rules of the road of investing.

In other news, bbc.com reports that researchers have found a sprawling Maya network discovered under a Guatemalan jungle.

sixcolors.com has a nice pie chart that shows how Apple makes its money (hint: 70% comes from the iPhone, 7% from the Mac).

inc.com has this article, 21 questions Amazon asks its job candidates.

Finally, here’s a series of tweets where Alastair McAlpine “asked some of my terminal paediatric palliative care patients what they had enjoyed in life, and what gave it meaning.” (Highly recommended reading.)

How to use the Linux ‘scp’ command without a password to make remote backups

Summary: How to create a public and private key pair to use ssh and scp without using a password, which lets you automate a remote server backup process.

Over the last two years I've ended up creating a large collection of websites and web applications on a variety of Linux servers that are hosted with different companies like GoDaddy and A2 Hosting. I recently embarked on a mission to automate the backup processes for all these sites, and as a result of this effort, I thought I'd share what I've learned here.

How to show the largest files under a directory on Mac OS X (Unix)

Here’s an example that shows how to find the largest files under a directory on MacOS and Linux/Unix systems.

A du/sort command to show the largest files under a directory on Mac OS X

The Unix/Linux command that worked for me on my MacOS system is this:

$ du -a * | sort -r -n | head -10

du is the disk usage command, and the -a flag says, “Display an entry for each file in a file hierarchy.” Then I use the sort command to sort the du output numerically and in reverse. After that, head -10 shows only the first ten lines of output. In the Music folder on my Mac the command and output look like this:

How to change the Mac Terminal title from the command line

Mac Terminal FAQ: How can I change the title on the Mac Terminal app from the Mac/Unix command line?

I've been working on a project where I have three Mac Terminal tabs open at one time, and I found it was much easier to work this way when I changed the title on each Terminal window. This helped me easily identify what I was doing in each Terminal window.

Changing the Mac Terminal title

The basic escape sequence you need to change the Terminal title from the command line is this: