I ran the following command and I am not able to understand why I am getting this error :

tail /var/log/fontconfig.log 1 >> /home/myuser/b.log
tail: cannot open '1' for reading: No such file or directory

File fontconfig.log exists and directory myuser exists too. However , this command works :

tail /var/log/fontconfig.log >> /home/myuser/b.log

Here , I have removed 1. Can any body explain why I am getting this error ? Also, If we don't mention any standard file descriptors like I did not mentioned 1 what does it take then ?


If you don't mention any file descriptor, it defaults to file descriptor 1 (standard output). If you do give an explicit descriptor, you must do so without whitespace before the >> operator. As noted in man bash:

   Appending Redirected Output
       Redirection of output in  this  fashion  causes  the  file  whose  name
       results  from  the expansion of word to be opened for appending on file
       descriptor n, or the standard output (file descriptor 1) if  n  is  not
       specified.  If the file does not exist it is created.

       The general format for appending output is:


So when you wrote

tail /var/log/fontconfig.log 1 >> /home/myuser/b.log

it tries to tail both /var/log/fontconfig.log and a file named 1, and redirect the resulting standard output to /home/myuser/b.log : the error is because you don't have a file named 1 from which tail can read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.