Layout problem when redirecting output to file using command prompt

When I’m using the command prompt of Git Bash and enter a command (e.g. ‘ls’), the output is okay (every filename is displayed on a separate line).
But when I redirect the output to a file (e.g. 'ls > OUT.txt`) and open it with Notepad, the entire output is displayed on 1 line only (line break/end of line is missing).
How can I redirect the output from the command prompt window to a file with every filename displayed on a separate line when opening it with Notepad?

Are you sure that is notepad specific problem?

what if you did:

cat OUT.txt

do you also get all the output on one line?

It’s not a Notepad specific problem, using other editors have the same problem.
When using 'cat OUT.txt the output is okay, which means that every filename is displayed on a separate line. I think this is because the output is displayed in the command prompt window. But when I try to redirect this output using 'cat OUT.txt > OUT2.txt, then opening OUT2.txt with Notepad has the same problem.
I think that somehow there’s a problem with recognizing the EOL characters when writing the output to a file.

here is a possible explanation:

different in new line characters between the different operating systems.

1 Like

I think the different line endings between Unix/Linux and Windows explains the problem.
But is there also a solution to get my output written to a Windows .txt file correctly?

Honestly? No idea. You would have to do some research into this matter