I/O Redirection
## command_output >
# Redirect stdout to a file
# Creates the file if not present, otherwise overwrites it.
$ ls -la > ls_result.txt
## : > filename
# The '>' truncates file 'filename; to zero length
# If file not present, creates zero-length file (same effect as 'touch')
# The ':' serves as a dummy placeholder, producing no output
$ : > empty_file.txt
## command_output >>
# Redirect stdout to a file
# Creates the file if not present, otherwise appends to it
$ ls -la >> ls_result.txtReferences
Last updated