Print files to standard output
TLDR
View documentation for the Zsh builtin
View documentation for the print alias of run-mailcap
View documentation for printing text files on Windows
SYNOPSIS
print [options] [argument ...]
PARAMETERS
-n
Do not output the trailing newline character.
-r
Raw mode. Do not interpret backslash escape sequences (e.g., \n, \t) in the arguments.
-R
Enhanced raw/formatted mode. Its specific behavior varies between shells; in ksh, it treats subsequent arguments as options to print itself, while in zsh, it interprets backslash escapes and printf-style format specifiers (e.g., \%). Consult your shell's manual for details.
-s
Write arguments to the shell's history file instead of standard output.
-u fd
Write arguments to the specified file descriptor fd (default is 1 for standard output).
--
Marks the end of options. Treats all subsequent arguments as non-option arguments, even if they start with a hyphen.
DESCRIPTION
The print command is a versatile shell built-in utility, primarily available in shells like ksh (KornShell) and zsh (Z shell). Its main function is to write arguments to the standard output, similar to the echo command, but often providing more control over escape sequences and output formatting. Depending on the shell, print may not automatically add a newline character, requiring explicit inclusion of \n if a line break is desired. It is frequently used in shell scripts for displaying messages, debugging output, or presenting formatted data. While printf (a different command) offers more complex C-style formatting, print provides a simpler, yet powerful, mechanism for text output directly within the shell environment.
CAVEATS
The print command is a shell built-in, meaning its availability and exact behavior (especially regarding options) can vary significantly between different shells. It is commonly found in ksh and zsh, but is not a standard external utility like ls or grep, nor is it a built-in in bash by default (where printf or echo are used instead). Users should consult their shell's documentation (e.g., man zshbuiltins or man ksh) for precise details.
HISTORY
The print command originated in the KornShell (ksh), developed by David Korn at Bell Labs, as a more robust and flexible alternative to the traditional echo command. It was later adopted by other shells, notably zsh, providing shell scripting with better control over output streams and escape sequence interpretation. Its design often aimed to address portability issues and inconsistent behaviors observed with echo across different Unix systems.