LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

print

Shell built-in text output command

TLDR

Print text (zsh/ksh)
$ print "Hello, World!"
copy
Print without newline
$ print -n "text"
copy
Print to file descriptor
$ print -u [2] "Error message"
copy
Print with escape sequences
$ print "Line1\nLine2"
copy

SYNOPSIS

print [options] [args]

DESCRIPTION

print is a shell built-in command available in ksh and zsh that outputs text to stdout. It provides more control than echo, supporting escape sequence processing, output to specific file descriptors, and suppression of the trailing newline.The -u option directs output to a numbered file descriptor (useful for writing to stderr or other open descriptors), while -l prints each argument on a separate line. Unlike echo, print's behavior is consistent and not affected by argument values that look like options.

PARAMETERS

ARGS

Text to print.
-n
No trailing newline.
-r
Ignore echo escape conventions (raw output).
-R
BSD-style echo; escape sequences only with -e.
-u N
Print to file descriptor N (e.g., -u2 for stderr).
-l
Print arguments on separate lines.
-N
Separate and terminate arguments with null bytes.
-f format
Format arguments using printf-style format string.
-P (zsh)
Perform prompt expansion on the arguments.
-s (zsh)
Save arguments in the history list instead of printing.
-v name (zsh)
Store the output in the parameter name instead of printing.
-c (zsh)
Print arguments in columns.

CAVEATS

Shell built-in. Not available in bash (use printf).

HISTORY

print is a ksh/zsh built-in for text output.

SEE ALSO

echo(1), printf(1)

Copied to clipboard
Kai