1Password CLI Cheatsheet


The 1Password CLI op works either in connection with a client app, like on the Mac, or standalone, useful on a server.

# Login
eval $(op signin)

# Get favorites
op item list --vault "Private" --favorite

# Get a specific item
op item get <ID>

# !! Important: Sign out at the end
op signout

Some helper functions

Helpers to more easily work with the op cli.

1login() {
    eval $(op signin)
}

alias 1signout="op signout"

1search() {
    term=$1
    if [ -n "$2" ]
    then
      vault="$2"
    else
      vault="Private"
    fi
    echo "Searching for '$term' in vaut '$vault'"
    op item list --vault "$vault" --long | grep "$term" --ignore-case
}

1get() {
    op item get $*
}

See also