1. Control of standard input
Syntax: The command file sends the execution results of the command to the specified file.
For example:
Ls-l > List writes the results of the "ls-l" command to the file list.
Syntax: Command >! The file sends the execution result of the command to the specified file, overwriting if the file already exists.
For example:
LS-LG >! List to write the results of the "LS-LG" command to the file list.
Syntax: command >& file writes any information that is generated on the screen to the specified file when the command executes.
For example:
CC file1.c >& Error writes any information that is generated when the file1.c file is compiled into the file error.
Syntax: commands >> files Attach the results of a command execution to a specified file.
For example:
Ls-lag >> List attaches the results of the Execute "ls-lag" command to the file list.
Syntax: commands >>& files Attach any information that is generated on the screen to the specified file when the command executes.
For example:
CC FILE2.C >>& Error appends any information generated by the screen to the file error when compiling the file2.c file.
3. Command syntax
Command > FileName redirect standard output to a new file
Command >> filename REDIRECT standard output to a file (append)
Command 1 > Fielname redirect standard output to a file
Command > FileName 2>&1 redirects the standard output to a file with standard errors
Command 2 > FileName redirect standard errors to a file
Command 2 >> filename REDIRECT standard output to a file (append)
Command >> filename 2>&1 redirects the standard output to a file (append) with the standard error
Command filename2 the command command with the filename file as the standard input, filename2 file as the standard output
Command &m redirects standard output to the file descriptor m
Command