Generating a temporary password using the 1Password CLI

Published on March 4th, 2026


Sometimes you just need to generate a password quickly. Put this in your ~/.zshrc (or equivalent for the shell you're using) and use tempw to copy a strong random password to your clipboard:

 1function tempw() {
 2  op item create --category password --generate-password --dry-run --format json | jq -r '.fields[0].value' | pbcopy
 3}

Found this snippet on the 1Password community forum.


Subscribe to the RSS feed if you want to be updated whenever new blog posts are posted.