Home

Use a Preceding Space in Terminal to Hide from History

This is a trick to running commands that you don’t want to be saved in your history.

You may want to run a command that isn’t stored in your history. You can do this with a preceding space.

# no preceding space
someCmd --key ABC123

history
# 98 ...
# 99 someCmd --key ABC123

# with preceding space
anotherCmd --key ABC123
cd ~

# notice `anotherCmd` is missing
history
# 98 ...
# 99 someCmd --key ABC123
# 100 cd ~

A common scenario may be when using sensitive values a single time (i.e. where you don’t want to take the time to set environment variables).

Let's Connect

Keep Reading

Delete Entire Word in Terminal and iTerm2

Ever find yourself holding down the Delete key on the command line? Here's a way to work faster.

Feb 08, 2021

Transforming Unsplash Images

Unsplash uses Imgix to serve its images, which means you can transform the images before downloading.

Dec 08, 2022

Git Checkout Previous Branch

Checkout the previous git branch without needing to remember or type the name.

Jul 27, 2022