> For the complete documentation index, see [llms.txt](https://manual.dxable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.dxable.com/1password/read.md).

# read

シークレット参照によって指定された 1Password 内のフィールドの値を読み取ります。

[シークレット参照とクエリ パラメータの詳細について説明します。](https://developer.1password.com/docs/cli/secret-reference-syntax/)

```
op read <reference> [flags]
```

#### **Flags** <a href="#wryrpje4rv88" id="wryrpje4rv88"></a>

```
    --file-mode filemode   Set filemode for the output file. It is ignored without the --out-file flag. (default 0600)
-f, --force                Do not prompt for confirmation.
-n, --no-newline           Do not print a new line after the secret.
-o, --out-file string      Write the secret to a file instead of stdout.
```

#### [**例**](https://developer.1password.com/docs/cli/reference/commands/read/#examples) <a href="#sxrv06lvssn5" id="sxrv06lvssn5"></a>

`password`アイテムのフィールドにSaveされている秘密を`db`金庫内に 出力します`app-prod`:

```
$ op read op://app-prod/db/password
```

クエリ パラメータを含むシークレット参照を使用して、ワンタイム パスワードを取得します。

```
$ op read "op://app-prod/db/one-time password?attribute=otp"
```

クエリ パラメータ付きのシークレット参照を使用して、OpenSSH 形式で SSH鍵の秘密キーを取得します。

```
$ op read "op://app-prod/ssh key/private key?ssh-format=openssh"
```

ssh保管庫内のアイテムで見つかった `SSH`鍵をコンピューターに`server`新しい`key.pem`ファイルとしてSaveします。

```
$ op read --out-file ./key.pem op://app-prod/server/ssh/key.pem
```

`op read`プレーンテキストのシークレットの代わりにシークレット参照を使うコマンドで使用します。

```
$ docker login -u $(op read op://prod/docker/username) -p $(op read op://prod/docker/password)
```
