Send Processes to the Background

Processes on any POSIX-compliant computer can be sent to the background with CTRL-Z (<prefix> + Z for the tmux-ers) and returned to the foreground with fg. Here is an example: user@computer:~% ping www.google.com PING www.google.com (74.125.228.212): 56 data bytes 64 bytes from 74.125.228.212: icmp_seq=0 ttl=52 time=41.574 ms 64 bytes from 74.125.228.212: icmp_seq=1 ttl=52 time=42.836 ms 64 bytes from 74.125.228.212: icmp_seq=2 ttl=52 time=53.527 ms ^Z zsh: suspended ping www.google.com user@computer:~% fg [1] + continued ping www.google.com 64 bytes from 74.125.228.212: icmp_seq=3 ttl=52 time=42.433 ms 64 bytes from 74.125.228.212: icmp_seq=4 ttl=52 time=42.401 ms 64 bytes from 74.125.228.212: icmp_seq=5 ttl=52 time=42.837 ms 64 bytes from 74.125.228.212: icmp_seq=6 ttl=52 time=44.203 ms ^C --- www.google.com ping statistics --- 7 packets transmitted, 7 packets received, 0.0% packet loss

April 21, 2021

Start Postgres.app from the Command Line

Today I was trying to restore a production Postgres dump on a remote machine, to test some migrations. I haven’t granted myself Heroku production database access, hence the SSH into a machine with a Heroku user that has access. I quickly hit a problem— this remote machine runs Postgres using Postgres.app. Without that program, I’m out of luck. No local Postgres server, no production database restore, no testing. It turns out you can start Postgres.app from the command line. Find the executable and call it. ...

April 21, 2021

Watch That Program

Have you ever been working in the terminal and found yourself repeating the same command many times? Delegate that work to the computer. watch comes with Linux and can be installed on OSX via homebrew. It executes a program periodically, defaulting to every two seconds. We used it today while writing a database backup script. Instead of checking our dump directory every time a cron job executed, we ran watch ls, and watched the script succeed or fail with live updates. ...

April 21, 2021

You Have New Mail

Here’s a familiar scenario: you open a new terminal, and before the prompt appears, you see the following. You have new mail. What’s going on here? ...

October 16, 2020

mgrim: Everything Updated All The Time

My current favorite command line alias is mgrim, composed of four other aliases. Here’s what it is, and what it does. ...

July 11, 2018

Don’t miss my next essay

Hear from me immediately when I post: no ads, unsubscribe anytime.