ls -l adds a total line (for total number of blocks) at the top of its output. Is there a direct way to suppress this line from the output? I know I can pipe the output into another command to delete the first line, but I am wondering if I am missing a simple option to suppress that line in the first place.

  • 2
    May be ls -ld * helps – Costas Oct 25 '16 at 19:35
  • @Costas joined here just to upvote that comment. Exactly what I was looking for. – Ryan Willis Dec 21 '17 at 2:14

No, you're not missing a simple option to drop the total line. For example, with GNU ls, the -l, -g, -n, -o and -s options cause the total line to be displayed, with no option to disable it:

if (format == long_format || print_block_size)
  const char *p;

  p = _("total");
  DIRED_FPUTS (p, stdout, strlen (p));
  p = human_readable (total_blocks, buf, human_output_opts,
                      ST_NBLOCKSIZE, output_block_size);
  DIRED_FPUTS (p, stdout, strlen (p));

This is actually mandated by POSIX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.