How to add new line between `ls -l` output

ls -l | sed G

(that one is a common idiom and on the sed FAQ).

Or (likely faster, probably doesn't matter for the (likely short) output of ls -l):

ls -l | paste -d '\n' - /dev/null

Those insert a blank line after each line of the output of ls -l.

Now, if you want an empty line after each file described by ls -l, which would be different if there are files whose name contains newline characters, you would have to do something like:

for f in *; do ls -ld -- "$f" && echo; done

(which would also skip the total line).

Or you could use ls -ql which would make sure you get one line per file (the newline characters, like all control characters would be rendered as ? (at least in the POSIX locale)).


Using awk:

ls -l | awk '{printf "%s\n\n", $0}'

NAME
       pr - convert text files for printing

Interleaving with single empty line, w/o adding header:

… | pr -dt

Tags:

Ls