ls

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 23 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ls implements the ls core utility, following the GNU manual.

It writes the name of every file given, and the names of the files contained in every directory given, defaulting to the working directory. The default output is one entry per line, as specified for output that isn't written to a terminal; on a terminal the entries fill the columns instead, their nongraphic characters are hidden, and their names are quoted the way the shell reads them.

Names are compared byte by byte, which is the collating sequence of the C locale, the only one here: no utility of this project implements the collating sequences of other locales. The fields of the long format are aligned the way GNU aligns them, and the timestamps and the quoted names are written as the C locale writes them.

The file system abstraction used here doesn't carry owners, so a file whose system information isn't available, like in a memory file system, is written with the numeric identifier zero for its owner and group, a link count of one, and no file serial number, and has its blocks measured by its size. Character and block special files are written with their size, as no device numbers are available either, and the birth time a system doesn't report is written as a question mark. Directory entries dot and dot-dot aren't reported by the Go file systems, so -A and -a are equivalent, and -f keeps the order the file system reports when it can, which a memory file system never can.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a new Prog.

Types

type Prog

type Prog struct {
	*coreutils.Runtime
}

Prog is the ls core utility.

func (*Prog) Run

func (p *Prog) Run(ctx context.Context, args ...string) error

Run lists the given files and the contents of the given directories, or the working directory when no operand is given. Listing stops when ctx is done, and the context error is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL