fixxxer fixxxer - 6 months ago 28
Bash Question

How do I list one filename per output line in Linux?

I'm using

ls -a
command to get the file names in a directory, but the output is in a single line.

Like this:
. .. .bash_history .ssh updator_error_log.txt

Is there a built-in alternative to get filenames, each on a new line, like this:



Use man ls to see if your ls supports the -1 option (that the "one" digit, not a lowercase letter "L" - thanks @slashmais), e.g.



   Prints one entry per line of output.

GNU/Linux's ls does support it, so use:

ls -1a