If you are redirecting the output of ls to a file, it will output a single file per line.
ls my_file my_file2 other_file
Use the -C option to have ls output its usual column format
ls -C > directory_contents.txt
my_file my_file2 other_file
A Software Blog from Marcos Savoury
If you are redirecting the output of ls to a file, it will output a single file per line.
ls my_file my_file2 other_file
Use the -C option to have ls output its usual column format
ls -C > directory_contents.txt
my_file my_file2 other_file