← 返回命令列表

Linux command

systemd-cat 命令

文本

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

常用示例

Write

systemd-cat [command]

Write

[command] | systemd-cat

Use

[command] | systemd-cat -t [id]

Use

systemd-cat -p [emerg|alert|crit|err|warning|notice|info|debug] [command]

Use

systemd-cat --stderr-priority [priority] [command]

说明

systemd-cat connects a command or pipeline's output streams to the systemd journal. It is useful for logging output from cron jobs, scripts, or any command that doesn't natively support journal logging. When run with a command, both stdout and stderr are captured. When used as a pipe target, only stdin (the pipe) is captured while stderr remains connected to the terminal.

参数

-t, --identifier _name_
Syslog identifier for log entries
-p, --priority _level_
Default priority level for stdout messages
--stderr-priority _level_
Priority level for stderr messages
--level-prefix _BOOL_
Interpret sd-daemon(3) style priority prefixes in log output (default: true)
-h, --help
Display help information

FAQ

What is the systemd-cat command used for?

systemd-cat connects a command or pipeline's output streams to the systemd journal. It is useful for logging output from cron jobs, scripts, or any command that doesn't natively support journal logging. When run with a command, both stdout and stderr are captured. When used as a pipe target, only stdin (the pipe) is captured while stderr remains connected to the terminal.

How do I run a basic systemd-cat example?

Run `systemd-cat [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --identifier _name_ do in systemd-cat?

Syslog identifier for log entries