Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


ls command (lists the contents of files or directories)

Organization of this page

Format

ls [-1] [-A] [-a] [-C] [-c] [-d] [-F] [-f] [-g] [-h] [-i] [-k]
  [-L] [-l] [-m] [-n] [-p] [-q] [-R] [-r] [-S] [-s] [-T] [-t]
  [-u] [-x]
  [--format=display-format][--full-time]
  [--indicator-style=file-type-style][--sort=sort-key]
  [--time=file-date-and-time-type]
  [path-name ...]

Description

The command lists directory contents. The contents are sent to the standard output.

In the output contents, permissions are displayed as described in the following:

If the -g, -l, -n, or --full-time option is specified, results are output in the long format.

The long format means that not only file and directory names but detailed information about files and directories are output. You can change the output format for each item by combining the long format with the -h, -T, and -u options.

Arguments

-1

--format=single-column

Specifies that the list format is to be one entry per line (in a single column).

-A

--almost-all

Specifies that all entries are to be listed except for those from those from . (dot) and .. (dot dot) files.

-a

--all

Specifies that all files and directories, including those with names starting with . (dot), are to be listed.

-C

--format=vertical

Specifies that entries are to be listed in multiple columns, sorted vertically. This is the default for output to the terminal.

-c

--time=ctime

--time=status

Specifies that the date and time of the last change in file information rather than the most recent modification date and time is to be used for sorting (-t option) and for list output (-g, -l, -n, and --full-time options).

-d

--directory

Specifies that only the directory names are to be listed, without displaying the contents of the directories.

-F

--classify

--indicator-style=classify

Specifies that a forward slash (/) is to be output after a directory name, an asterisk (*) is to be output after an executable file, an at mark (@) is to be output after a symbolic link, a vertical bar (|) is to be output after a FIFO name, and an equal sign (=) is to be output after a socket.

-f

--sort=none

Specifies that the list is to be output without sorting.

-g

Specifies that the list is to be output in long format, but without listing the file owners.

-h

--human-readable

Specifies that when the long format is used, file sizes are to be divided by a power of 2 and rounded off to two decimal places for display purposes. A size letter (M for 1048576 or K for 1024) is to be added to the file size.

The -h option is ignored for any special files in a directory.

-i

--inode

In UNIX, specifies that each file's inode number is to be output.

In Windows, 0 is always output.

-k

In UNIX, specifies that KB is to be output as the units for listing file sizes with the -s option and as the units for listing the total number of blocks for directories with the -l, -g, -s, and --full-time options.

In Windows, specifies that KB is to be output as the units for listing file sizes with the -s option.

-L

--dereference

In UNIX, specifies that list information about a referenced file rather than the symbolic link itself is to be output.

In Windows, list information about a referenced file is always output.

-l

--format=long

--format=verbose

Specifies that the list is to be output in long format with the following items displayed. To output date and time in the complete format, specify the --full-time option.

  • UNIX

    Access permissions, number of links, owner name, group name, size, most recent modification date and time, name of file or directory. If the target is directories, the total number of directories including . and .. under that directory are displayed.

  • Windows

    Access permissions for the owner of the file, owner name, size (except for directories), most recent modification date and time, name of file or directory

-m

--format=commas

Specifies that file names are to be delimited by the comma (,).

-n

--numeric-uid-gid

In UNIX, specifies that user IDs and group IDs are to be listed instead of user names and group names.

In Windows, 0 is listed for a user ID, and group IDs are not output.

-p

--indicator-style=slash

Specifies that a forward slash (/) is to be output after a directory name.

-q

--hide-control-chars

Specifies that a question mark (?) is to be output for any unprintable character used in a file name. This is the default for output to the terminal.

-R

--recursive

Specifies that subdirectories are to be listed recursively.

-r

--reverse

Specifies that the output is to be sorted in reverse order.

-S

--sort=size

Specifies that the entries are to be sorted by size, from largest to smallest.

-s

--size

In UNIX, specifies that the number of blocks in each file, rounded up to full blocks, is to be output. A block is 512 bytes, unless you also specify the -k option or have defined the BLOCKSIZE environment variable.

In Windows, the number of blocks is always listed as 0.

-T

Specifies that date and time information is to be listed in the order month, date, hour, minute, second, and year. This option is specified together with the -g, -l, or -n option.

-t

--sort=time

Specifies that the entries are to be sorted by most recent modification date and time, starting with the most recent.

-u

--time=atime

--time=access

--time=use

Specifies that the most recent access date and time instead of the most recent modification date and time is to be used when sorting (-t option) or listing in the long format (-g, -l, -n, or --full-time option).

-x

--format=across

--format=horizontal

Specifies that entries are to be listed in multiple columns, as with -C, but sorted horizontally.

--format=display-format

Specifies the format for displaying file or directory contents.

The permitted values for display formats are listed below. If the --format option is specified more than once, the last option specified takes effect.

across or horizontal

Specifies that entries are to be listed in multiple columns, sorted horizontally. This is the same as the -x option.

commas

Displays file names separated by the comma (,). This is the same as the -m option.

long or verbose

Displays in the long format. This is the same as the -l option.

single-column

Displays one entry (one column) per line. This is the same as the -l option.

vertical

Displays multiple columns, sorted vertically. This is the same as the -C option.

--full-time

Specifies that the same items as when the -l option is specified are to be output. However, information about the date and time is to be output in the complete format, not in the default abbreviated format.

The output format for the date and time information is as follows:

YYYY-MM-DD hh:mm:ss.nnnnnnnnn +/-hhmm

YYYY: Calendar year

MM: Month

DD: Date

hh: Hour

mm: Minute

ss: Second

nnnnnnnnn: Date and time less than one second. 000000000 is always output.

+/-hhmm: Time zone (the time differential from UTC).

--indicator-style=file-type-style

Specifies the style to be used to display information about the file type.

The following values are supported:

classify

Outputs the character indicating the file type immediately after the file name. For a directory name, a forward slash (/) is displayed immediately after the directory name. This is the same as the -F option.

For details about the characters used to indicate file types, see the description of the -F option.

slash

Displays a forward slash (/) immediately after the directory name. This is the same as the -p option.

If --indicator-style=classify is specified together with --indicator-style=slash, the classify specification takes effect.

In Windows, classify is ignored, if specified.

--sort=sort-key

Specifies that when multiple files are displayed, they are to be sorted by the file information indicated by the specified sort key. If the --sort option is specified more than once, the last specification takes effect.

For the sort key, the following values are supported:

size

Sorts files by file size. This is the same as the -S option.

time

Sorts files by most recent modification date and time. This is the same as the -t option. You can also specify the --time option to sort files by the date and time each was last accessed or changed.

none

Outputs files without sorting them. This is the same as the -f option.

--time=file-date-and-time-type

Specifies a file date and time type that is to be applied to date and time information used for sorting (-t) and listing (the -g, -l, -n, and --full-time options). If the --time option is specified more than once, the last specification takes effect. If more than one option is specified, the last option takes effect. In Windows, --time is ignored, if specified.

For the file date and time type, the following values are supported:

atime, access, or use

Uses the last date and time files were accessed. This is the same as the -u option.

ctime or status

Uses the last date and time file information was changed. This is the same as the -c option.

path-name

Specifies the name of a file or directory that is to be listed. More than one can be specified.

Return codes

Return code

Meaning

0

Normal termination

1 or greater

Error termination

Notes

Usage examples