Save Size Change to iTerm Profile

The longer I program (ahem), the bigger I want my terminal fonts. I think most programmers should be using a bigger font than they are. Complicating matters, the standard font for iTerm is miniscule on a computer monitor. Today I discovered iTerm’s ‘View > Size Changes Update Profile’ feature. When enabled, changes to your font size via ⌘ + and ⌘ - will be applied to your iTerm profile. The next time you open iTerm, the new font size will persist.

November 13, 2021

Autojump and Open

I love autojump. I use it because I think that remembering my location in a directory structure relative to other directories, so I can navigate with cd, is mental energy I could be using for something else. Today I learned that autojump has a jo command, which jumps to a directory and opens it in your file explorer. jo Desktop This might be a throwaway lesson if I wasn’t regularly sidetracked by the MacOS file explorer. Finding a file using the file explorer is a routine operation I have yet to do fluidly on a Mac. This helps!

November 6, 2021

Command Line Subshell

When chaining commands in the terminal, you may need to do things that affect the shell’s environment, like change directories. Here’s an example: $ yarn install && cd ios && pod install && cd .. && yarn build These cd’s can clutter up a script, and they’re incidental. My solution is to use a subshell (here’s the explanation from man bash): (list) list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT below). Variable assignments and builtin commands that affect the shell’s environment do not remain in effect after the command completes. The return status is the exit status of list. ...

August 2, 2021

Directional Commands

You can move the cursor without arrow keys. Here is the keyboard equivalent for each. Up (‘previous’): CTRL + P Down (’next’): CTRL + N Left (‘back’): CTRL + B Right (‘forward’): CTRL + F Mapping caps lock to CTRL makes these combinations very accessible.

April 21, 2021

Finding Getters

After writing the other day about why you might not want to use simple getters, I decided that I wanted to eliminate all such methods from a project. Here is the regex I wrote to isolate the pattern: ag 'def (\w+);?\s+@\1;?\s+end' The semicolon catches one-line getter methods as well as the more common three-line.

April 21, 2021

MD5 File Signatures

The command md5 <file> generates a unique 32-digit hexadecimal number. This can serve as a signature for a file in its particular state, letting you know when it has changed. Example usage: $ touch test.txt $ md5 test.txt MD5 (test.txt) = d41d8cd98f00b204e9800998ecf8427e $ echo 'some content' > test.txt $ md5 test.txt MD5 (test.txt) = eb9c2bf0eb63f3a7bc0ea37ef18aeba5

April 21, 2021

Printing with lpr

Recently while trying to fix a printer I used lpr a bunch of times. It’s not exactly new to me, but never fails to surprise people when I use it. lpr submits files for printing to your default printer in OSX. Print a file: lpr README.md Print the current file in your Vim session, with a cool job name: :! lpr -T 'cool job name' % Print two copies to a specific printer: ...

April 21, 2021

Reverse a String

Reverse a string with the rev command. $ echo 'test' | rev tset It also works with files. $ rev Procfile br.amup/gifnoc C- amup cexe eldnub :bew

April 21, 2021

Run Previous Command

Previously run commands can be viewed with the history command. $ history 10048 git checkout master 10049 gpr 10050 rake With this list, you can rerun any command using !n: $ !10048 Already on 'master' The command !! prints the last command you ran, then runs it. Here is an example: $ ls LICENSE.md README.md bash cucumber rails $ !! ls LICENSE.md README.md bash cucumber rails Replace the second ! with the first few letters of a command you have previously run, and bash will search for, print, and run the most recent instance. ...

April 21, 2021

Screen Flashing in OSX

I like a quiet computer. But I also like tab-completing commands in the terminal, which produces a necessary alert from time to time. A solution I found today is to use OSX Accessibility features to add a screen flash on alerts, then disable the sounds. System Preferences > Accessibility > Hearing menu, choose ‘Audio’ > Check ‘Flash the screen when an alert occurs’

April 21, 2021

Don’t miss my next essay

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