Read lpr Configuration

I’ve written about lpr before; to me the ability to send a file to my printer from the command line is a magic trick. What if I want to know where the file is going to go before sending it? lpr’s docs say: The LPDEST and PRINTER environment variables are consulted first. If neither are set, the current default set using the lpoptions(1) command is used, followed by the default set using the lpadmin(8) command. ...

August 31, 2026 · 1 min · Jake Worth

Overwrite vs. Append

I use the append >> and overwrite > redirection operators all the time. Today I’d like to share a simple mental model I’ve developed for remembering which is which. ...

March 13, 2026 · 1 min · Jake Worth

Who Owns This Program?

I’ve got a command docker on my machine. I need to upgrade it. So, who owns it? ...

February 9, 2026 · 1 min · Jake Worth

Calculating With Bc

Today I accidentally I found a calculator on my computer, bc. Let’s look at it! ...

January 7, 2026 · 1 min · Jake Worth

pbcopy, no cat

My friend Josh recently wrote about a common mistake using pbcopy, Apple’s pasteboard utility. ...

March 5, 2025 · 1 min · Jake Worth

Read Zsh Builtin Manual Pages

In Zsh, if you type man cd, instead of a manual page, you’ll get this: See the built-in command description in the appropriate shell manual page. To see Zsh’s implementation of cd, we need to view Zsh’s built-in man page: man zshbuiltins ...

May 22, 2024 · 1 min · Jake Worth

Append to a Write-Protected File

Suppose you want to append to a file that’s write-protected and can only be edited via sudo. Is that possible? It is! A technique I discovered today is to use tee with sudo: $ cat file.txt | sudo tee -a /etc/hosts This lets me append the contents of file.txt to the write-protected /etc/hosts file by entering my password.

February 22, 2024 · 1 min · Jake Worth

Create a File With `cat`

When you combine cat (concatenate) with > (output redirection), you can create and write to a file from the command line. $ cat > test.txt Hit enter after the file name, and your terminal will wait for input. End the file with CTRL + D. $ cat > test.txt one two three $ cat test.txt one two three >> works, too; appending to the file as expected.

December 12, 2023 · 1 min · Jake Worth

Override Autojump's Directory Rankings

Autojump is my tool of choice for navigating directories. If I enter the following into the terminal: $ j til Autojump will try to guess where I want to go among directories I’ve previously visited. It uses a database of directories and their relative rankings to do so. But there’s a problem! These day I only want to visit ~/oss/til. In the past I’ve visited ~/oss/hr-til and ~/oss/tilex hundreds of times. Autojump always sends me there first. I don’t want that! ...

March 8, 2023 · 1 min · Jake Worth

Force ASDF Reshim

When I upgrade ASDF, I sometimes get an error like this when I try to run a command: /Users/jakeworth/.asdf/shims/jq: line 3: /usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf: No such file or directory The issue is that I’ve upgraded ADSF to v0.10.2, but the jq shim doesn’t know that and can’t find it in a directory called “0.9.0”. This issue persists even after running asdf reshim. My solution is to force ASDF to rebuild shims directory by renaming it. A rename lets me get back to where I am now, in case I need to. ...

June 21, 2022 · 1 min · Jake Worth