cmd >>file.txt 2>&1
Bash executes the redirects from left to right as follows:
>>file.txt: Openfile.txtin append mode and redirectstdoutthere.2>&1: Redirectstderrto “wherestdoutis currently going”. In this case, that is a file opened in append mode. In other words, the&1reuses the file descriptor whichstdoutcurrently uses.