The following command displays output only on the screen (stdout).
$ ls
The following command writes the output only to the file and not to the screen.
$ ls > file
The following command (with the help of tee
command) writes the output both to the screen (stdout) and to the file.
$ ls | tee file