The exec command can be used to execute a certain file. For example, to exectue the init file, to restart the system.
~]# exec /sbin/init
The exec command can be used to redirect all commands to a file. In this example, the exec command redirects commands to MyFile.
~]# exec > MyFile
After running the exec command, following commands will not produce any output. For example, the date command does not produce any output.
This happens because the output of the date command was written to MyFile. Closing the shell, and then opening the shell again will allow you to view the contents of MyFile. The output of the date command will be in MyFile.
~]# cat MyFile Fir Apr 14 18:37:07 CDT 2017