redirection

Bash append output

Open for appending; creates a missing file and preserves existing contents. Defaults to stdout.

Formal Syntax & Structure

bash syntaxbash
[n]>>file

Parameters & Attributes

NameTypeDescription
filepathOutput file in a writable directory.

Return Value

redirection effect

Open for appending; creates a missing file and preserves existing contents. Defaults to stdout.

Working Example

Example Snippetbash
printf '%s\n' first > notes.txtprintf '%s\n' second >> notes.txtcat notes.txtprintf '%s\n' replacement > notes.txtcat notes.txt
Bash Reference