What is M in Linux? Control M ( ^M) characters are introduced when you use lines of text from a windows computer to Linux or Unix machine. Most common reasons are when you directly copy a file from a windows system or submit form data copied and pasted from a windows machine.
How do you enter M in Linux? To enter ^M, type CTRL-V, then CTRL-M. That is, hold down the CTRL key then press V and M in succession. To enter ^M, type CTRL-V, then CTRL-M. That is, hold down the CTRL key then press V and M in succession.
How do I get rid of M in Linux? Another way to do remove them is to use vi or vim. Just like we use the :e ++ff=unix vi command to see the ^M carriage returns, we can use the :set ff=unix command to remove them once the file is loaded into the vi editor. Here is an example using sed to remove the ^M carriage returns from a file.
How do you type an M character? To enter ^M, type CTRL-V, then CTRL-M. I mean, hold down the CTRL key then press V and M in succession. The sed command is really helpful in case of removing ^M characters from large and huge files because you don’t need to open the files into VI or any other editor.