You will get an error message if you try to display the contents of a file that doesn't exist:
elliot@ubuntu-linux:~$ cat blabla
cat: blabla: No such file or directory
Now, this error message comes from standard error (stderr). If you try to redirect errors the same way we did with the standard output, it will not work:
elliot@ubuntu-linux:~$ cat blabla > error.txt
cat: blabla: No such file or directory
As you can see, it still displays the error message on your terminal. That's because stderr is linked to file descriptor 2. And thus, to redirect errors, you have to use 2>:
elliot@ubuntu-linux:~$ cat blabla 2> error.txt
Now if you displayed the contents of the file error.txt, you would see the error message:
elliot@ubuntu-linux:~$ cat error.txt
cat: blabla: No such file or directory
Let's try to remove a file that doesn't exist:
elliot@ubuntu-linux:~$ rm brrrr
rm: cannot remove 'brrrr': No such file or directory
This also...