← 返回命令列表

Linux command

postmap 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create hash database from text file

postmap [/etc/postfix/virtual]

Create database with specific type

postmap hash:[/etc/postfix/transport]

Query database

postmap -q [key] [/etc/postfix/virtual]

Show all entries

postmap -s [/etc/postfix/virtual]

说明

postmap creates and queries Postfix lookup tables. It converts plain text files containing key-value pairs into indexed database formats (hash, btree, dbm) for efficient lookups by the Postfix mail system. Common uses include virtual alias maps, transport maps, and access control tables. After editing a text lookup file, postmap must be run to rebuild the corresponding .db file that Postfix actually reads. The query mode (-q) allows testing individual lookups, and the show mode (-s) displays all entries, both useful for verifying that mappings work as expected before applying them to live mail delivery.

参数

-q _key_
Query for key.
-s
Show all entries.
-d _key_
Delete key.
-i
Incremental mode.
-N
Include the table name as part of a lookup key or value.
-w
Wait for locked files.

FAQ

What is the postmap command used for?

postmap creates and queries Postfix lookup tables. It converts plain text files containing key-value pairs into indexed database formats (hash, btree, dbm) for efficient lookups by the Postfix mail system. Common uses include virtual alias maps, transport maps, and access control tables. After editing a text lookup file, postmap must be run to rebuild the corresponding .db file that Postfix actually reads. The query mode (-q) allows testing individual lookups, and the show mode (-s) displays all entries, both useful for verifying that mappings work as expected before applying them to live mail delivery.

How do I run a basic postmap example?

Run `postmap [/etc/postfix/virtual]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -q _key_ do in postmap?

Query for key.