$’\r’: command not found

Working between Windows and Linux machines can be liberating, but a bit of a pain at times. One of these times is when creating scripts on a Windows PC and copying them over to a Linux box only to receive “$’\r’: command not found” when attempting to execute them.

This is due to the files being saved in DOS format where new lines are delimited with \r\n as opposed to the *nix \n format.

You can either ensure the files are saved in Unix format in your Win text editor, or even use this extremely easy method to process them on the Linux box:

sudo apt-get install dos2unix
sudo dos2unix <your filename here>


3 thoughts on “$’\r’: command not found

Leave a Reply

Your email address will not be published. Required fields are marked *