Decoded: dir (coreutils)

[Back to Project Main Page]

Note: This page explores the design of command-line utilities. It is not a user guide.
[GNU Manual] [No POSIX requirement] [Linux man] [FreeBSD man]

Logical flow of dir command (coreutils)

Summary

dir - brief list of directory contents

[Source] [Code Walkthrough]

Lines of code: 2
Principal syscall: None
Support syscalls: None
Options: 2 (help and version)


Setup

The two lines of code for dir set the global mode of the ls utility.


Parsing

The dir utility forces the -C and -b options during parsing


Execution

See ls. The dir utility executes the same code as ls except that it guarantees column listing and C-style escaped names.

Note that dir is a standalone utility and does not directly depend on ls.


[Back to Project Main Page]